Bring a large pot of salted water to a boil. Add the spaghetti and cook as the label directs for al dente. Reserve 1 1/4 cups cooking water and then drain.
Meanwhile, combine the olive oil and pancetta in a large wide pot over medium-high heat. Cook, stirring occasionally, until the pancetta is golden brown and crisp, 3 to 5 minutes. Stir in 1 teaspoon pepper, then add 3/4 cup of the reserved cooking water and the spaghetti, tossing until combined. Stir in the ricotta and 2 tablespoons pecorino, tossing constantly to evenly coat. (The ricotta will seem thick at first, but as it combines with the hot cooking water it will create a creamy sauce.) Add more cooking water a few tablespoons at a time if the sauce is too thick or dry. Season with salt.
Divide the spaghetti among bowls. Sprinkle with the remaining 2 tablespoons pecorino and 2 teaspoons pepper.