Yes, peanuts are good for you. But don't have too many.

With a market size of more than $90 billion, peanuts are one of the world's most popular nuts. People love their rich, nutty flavor and that roasting can enhance their taste. Abbie McLellan, a clinical dietitian with Stanford Health Care, says peanuts are also loved for their versatility as they can be eaten raw, roasted, fried,or boiled. That versatility and their unique flavor makes peanuts popular ingredients in scores of recipes including in baked goods, soups, salads, Asian dishes, candies and, of course, peanut oil and peanut butter.

Peanuts are also better for you than you might think. Here's how – and why should still avoid overconsumption.

What are peanuts?

Though technically a legume, peanuts are often treated as nuts in culinary terms. They're widely grown in tropical and subtropical regions, with China, Indi, and Nigeria being the world's top producers. The U.S. produces more than 6 billion pounds of peanuts per year, which is about 5% of the world's peanuts. The majority of that production comes out of Georgia.

McLellan explains that peanuts are grown underground and are typically harvested in the fall, about four to five months after being planted.

According to the National Peanut Board, peanuts began to be popular in the late 1800s when they were sold at baseball games and by vendors at P.T. Barnum's circus. They're still a staple at ball games and circus acts across the country, and are popular customer freebies at restaurants and fast-food chains like Texas Roadhouse and Five Guys.

Related: Your favorite childhood snack is healthier than you thought. That's right: peanut butter

Are peanuts good for you?

No matter where you get your peanuts, they offer a host of health benefits. According to the U.S. Department of Agriculture, just one cup of raw peanuts contains nearly 7 milligrams of iron, 134 milligrams of calcium, 245 milligrams of magnesium, 549 milligrams of phosphorus and a whopping 1,030 milligrams of potassium. They also contain selenium, zinc, folate and vitamin E. Such nutrients are associated with benefits like a stronger immune system and skin, eye, bone and heart health.

"Besides their essential vitamin and mineral content, peanuts’ health benefits are also associated with the vast number of phytochemicals present," says Katherine Tallmadge, a nutrition author and registered dietitian at Personalized Nutrition. Phytochemicals are chemical compounds that play a role in protecting against chronic diseases.

One cup of peanuts also packs more than 37 grams of protein – a nutrient that's vital for energy and for muscle maintenance, repair and growth. And the same amount contains more than 12 grams of dietary fiber, which is crucial for digestive health and for keeping blood sugar levels in check.

At 17 milligrams per cup, peanuts also contain more niacin than any other nut. This B vitamin is helpful in supporting your digestive system and your nervous system, and has also been associated with reduced arthritis pain.

"Peanuts also provide healthy unsaturated fats such as omega-3 and omega-9 fatty acids, which are good for heart health," says McLellan. "And they contain coenzyme Q10 - a powerful antioxidant that protects the heart from damage," adds Tallmadge.

Study up: How to test your blood sugar levels and why it's critical for some people

Is there a downside to eating peanuts?

Despite so many benefits, moderation is still important when it comes to eating peanuts. For one, a cup of the nuts contains more than 800 calories and 72 grams of fat, making them problematic for healthy weight management if consumed excessively.

Tallmadge adds that many nuts can pose issues for people with allergies; "peanut allergies can be deadly." Various peanut varieties can also have potentially harmful additional ingredients. For instance, "you could quickly exceed the daily recommended sodium intake by eating salted peanuts," says McLellan.

But if you keep in mind such considerations, peanuts can be a "healthy, fun snack to enjoy," says Tallmadge. "With their exceptional nutritional content and associated benefits, perhaps we could all find more ways to include peanuts in our diet."

This article originally appeared on USA TODAY: Are peanuts good for you?