Bring a large pot of salted water to a boil. Add the spaghetti and cook according to package instructions until al dente. Reserve 1 cup of pasta water, then drain the pasta.
While the pasta cooks, heat a large skillet over medium heat. Add the diced pancetta or bacon and cook for 5-7 minutes, stirring occasionally, until crispy. If using garlic, add it in the last minute of cooking. Remove from heat.
In a medium bowl, whisk together the eggs and grated Parmesan cheese until smooth. Season with a generous amount of freshly ground black pepper.
Add the drained spaghetti to the skillet with the pancetta. Toss to coat the pasta in the rendered fat, then remove the skillet from the heat.
Quickly pour the egg and cheese mixture over the hot pasta, tossing continuously to create a creamy sauce. If the sauce is too thick, add a splash of reserved pasta water until it reaches your desired consistency.
Taste and adjust seasoning with salt (if needed, as pancetta is salty) and more black pepper. Serve immediately, garnished with chopped parsley if desired. Enjoy your spaghetti carbonara!