The government study, in which over 5,500 people took part, found that tea or coffee drinkers were about half as likely as non-drinkers to contract methicillin-resistant Staphylococcus aureus (MRSA) in their nostrils.
MRSA is a pathogen which is highly resistant to some antibiotics and causes thousands of deaths worldwide every year, the Daily Mail reported.
Study author Eric Matheson, of the University of South Carolina said: "Consumption of hot tea or coffee is associated with a lower likelihood of MRSA nasal carriage."
"Our findings raise the possibility of a promising new method to decrease MRSA nasal carriage that is safe, inexpensive, and easily accessible."
The idea for the study came from the fact that, in both the lab dish and in humans, topically applied or inhaled tea extracts have shown some anti-MRSA activity, he said.
Less research has been done on coffee compounds, but there is some evidence of antibacterial powers there as well.
The researchers, who detailed their findings in the journal Annals of Family Medicine, said about 1.4 per cent of the study group harboured the bacteria in their noses.
But the odds were about 50 per cent lower among people who said they drank hot tea or coffee, versus non-drinkers.
The big caveat, though, is that the link does not prove that tea or coffee are the reason for the lower risk, Matheson said.
The study shows an association between the two, "but you never can conclude causation from an association. I can't tell you that this finding isn't just a coincidence," he said. The researchers tried to account for several other factors, such as age, income or self-rated health, but the beverages were still linked to lower odds of being a MRSA carrier.
One issue is that even if coffee and tea drinkers do have a lower risk of carrying MRSA, whether that makes them less likely to actually fall ill is unknown.
Matheson said there is also still debate about whether MRSA carriers are at increased risk of developing an active infection.
For now, the researchers stopped short of recommending that people start drinking coffee or tea in the hopes of fending off MRSA.
"Based on one association study, that would probably be too much," Matheson concluded.