Often heartburn is caused by eating certain foods, such as:  Fatty and fried foods. Garlic and onions. Spicy foods. Tomato-based foods, such as spaghetti sauce, salsa and pizza.