The study looked at a group of Puerto Rican women who eat lots of onions and garlic which are key ingredients in local foods including sofrito, a sauce, as well as stews, and rice dishes.
They found that those who ate sofrito more than once a day had a 67 per cent decrease in risk of getting breast cancer compared to those who never ate it.
A typical sofrito is made of finely chopped bell peppers, onions, garlic, ground oregano, apple cider vinegar, tomato paste, water and coriander.
In their new study, scientists wanted to examine the association between onion and garlic consumption and breast cancer in Puerto Rico.
The researchers, from the University at Buffalo (UB) and the University of Puerto Rico, chose to study a group of Puerto Rican women who eat lots of onions and garlic which are key ingredients in sofrito, stews, and rice dishes.
Lead study author Gauri Desai, a PhD student from the University at Buffalo, said: "We found that among Puerto Rican women, the combined intake of onion and garlic, as well as sofrito, was associated with a reduced risk of breast cancer.
"In fact, those who consumed sofrito more than once per day had a 67 per cent decrease in risk compared to women who never ate it.
"Studying Puerto Rican women who consume a lot of onions and garlic as sofrito was unique.
"Puerto Rico was a perfect place to study because women there consume larger amounts of onions and garlic than in Europe and the US due largely to the popularity of sofrito.
"Onions and garlic also are eaten regularly in guisos (stew), as well as in bean- and rice-based dishes in Puerto Rican cuisine."
There is currently little research on breast cancer in Puerto Rico which has lower rates of the disease compared with the rest of the US.
The idea for the study stemmed from previous scientific evidence that found eating onions and garlic may have a protective effect against cancer.
Researchers focused on onion and garlic which are rich in flavonols and organosulfar compounds which show anticarcinogenic properties in humans.
Senior study author Dr Lina Mu, an associate professor at UB, said: "In particular, garlic contains compounds such as S-allylcysteine, diallyl sulfide and diallyl disulfide, while onions contain alk(en)yl cysteine sulphoxides.
"These compounds show anticarcinogenic properties in humans, as well as in experimental animal studies."
The case-control study was named the Atabey Study of Breast Cancer after the Puerto Rican goddess of fertility.
More than 300 women were enrolled in the study which took place between 2008 and 2014 and included 314 women with breast cancer and 346 control subjects.
The findings were published in the journal Nutrition and Cancer