Mazda says the yellow sac spider, which is attracted to hydrocarbons, can weave a web in a vent hose. The webs can cause pressure buildup in the fuel tank, which can increase the chance of fuel leaks and fires.
The recall affects 42,000 Mazda6 2010 through 2012 models in the U.S. that are equipped with 2.5-liter engines.
No injuries or fires have been reported because of the issue, Mazda said.
This isn't the first time Mazda has issued such a recall; the first came in 2011, for the same problem. The company has put covers on the vent line, but spiders can still get past them.
Mazda says it will provide free software updates for the cars starting this month to ensure fuel tank pressure doesn't buildup.
The Associated Press contributed to this report.