Bring a large pot of salted water to a rolling boil and cook the spaghetti until al dente, about 8–10 minutes; reserve 1/2 cup pasta water, then drain the pasta.
Meanwhile, melt the butter in a large skillet over medium-low heat, then add the minced garlic and sauté about 1 minute until fragrant, taking care not to brown it.
Pour in the heavy cream and bring to a gentle simmer over medium heat; cook about 10 minutes until slightly thickened, stirring occasionally.
Season the cream sauce with kosher salt to taste and the black pepper.
Reduce heat to low, add the drained spaghetti to the skillet, and toss to coat. Add reserved pasta water a little at a time if the sauce is too thick until you reach the desired consistency.
Stir in the grated Parmesan until it melts into a smooth sauce, taste, and adjust seasoning if needed.
Serve immediately, garnished with chopped fresh parsley if desired.