To make marinara sauce, heat olive oil in a saucepan over medium heat. Add garlic, basil and red pepper flakes; cook and stir for a minute or two until fragrant. Stir in sugar, vinegar, salt, and pepper. Pour in tomatoes with their juices and simmer over low heat for 15 minutes. Remove from heat and puree until smooth in food processor or blender.