Cut the pancetta into tiny pieces.
Heat the olive oil in a saucepan. When it is hot, add the pancetta and sauté until golden (about 15 minutes). Meanwhile, chop the onion coarsely.
Remove the pancetta from the saucepan with a slotted spoon and set it aside. Add the onion to the oil in the saucepan and sauté gently until soft and translucent (about 15 minutes). Add the tomatoes and tomato paste, then taste for salt and pepper and add the hot pepper flakes. Reduce the sauce very slowly for about 20 minutes.
While the sauce is reducing, place a stockpot containing a large quantity of cold water on the heat. When the water boils, add salt to taste, then the spaghetti, and cook until al dente (9 to 12 minutes, depending on the brand).
When the sauce is reduced and the spaghetti almost cooked, place the pancetta back in the sauce and simmer it for 1 minute more. Remove the pan from the flame.
Drain the spaghetti in a colander and place it in a serving bowl. Pour the sauce on top and sprinkle with the Parmigiano. Toss very well and serve hot.