Place olive oil and onion on a pan over medium heat.
Cook the onions while stirring every once in a white until they turn translucent and then let them become golden as well. Don't turn the heat up or the onions will not cook through and you'll get a strong onion flavour in your sauce.
Add the garlic (and the tomato paste as well if you'll be using fresh tomatoes) and stir for one minute as they cook.
Add the canned tomatoes (whole) or the fresh tomatoes (peeled and cut in 4) and let them release liquid. Let it boil until there's little liquid on the pan.
If your pan can go in the oven, then it goes straight into a preheated oven at 250C / 480F for 15-20min or until you see that it's caramelizing on top and there's nearly no liquid left. If your pan cannot go in the oven then transfer the contents to a baking dish or tray first.
Remove the sauce from the pan and blend until smooth. Adjust the level of salt and pepper and done!