Add the onion, garlic, 1/2 teaspoon salt, and 1/4 teaspoon pepper and cook, stirring, until soft, 6 to 7 minutes.
Add the cream cheese and milk and cook, stirring, until the cream cheese is melted. Squeeze any excess liquid out of the spinach, add the spinach to the sauce, and cook until the mixture is heated through and thickened, 3 to 4 minutes.