Mayor Ed Lee signed into law an edict to prohibit the use of smokeless tobacco at athletic venues, specifically singling out baseball, which has a long history of players chewing and spitting out tobacco juice in view of children who worship them.

The San Francisco law, effective from January 1, is part of an overall push by the Campaign for Tobacco-Free Kids, based in Washington DC, which targeted the city and California to promote its anti-smoking efforts.

An even more expansive bill outlawing all tobacco use, including electronic cigarettes and smokeless tobacco, wherever an organised game of baseball is played in California, is making its way through the state assembly.

"Today, San Francisco entered the history books as the first city to take tobacco out of baseball. The home of the World Champion Giants has set an example that all of Major League Baseball and the rest of the country should quickly follow," said Campaign for Tobacco-Free Kids president Matthew Myers.

Smokeless tobacco, including moist snuff and chewing tobacco, has been banned in the minor leagues since 1993, but because major leaguers are unionised, Major League Baseball cannot ban it without an agreement with the Major League Baseball Players Association.

Under the current contract, players, managers and coaches cannot chew tobacco during interviews or carry tobacco while wearing a uniform when fans are in the stadium.

Major League Baseball said it supported the efforts of the city of San Francisco "to protect our nation's youth by eliminating smokeless tobacco products from all ballparks".

"We're aware of the signing of the law and have no public comment at this time," said players' union spokesman Greg Bouris said.

Madison Bumgarner, who holds the World Series most valuable player (MVP) award, chews tobacco but said he stopped for about three months in the spring before recently picking up the habit again. He says he will try to quit again before next season when the ban begins.

"I'll be all right. I can quit," he said. "I quit every once in a while for a little while to make sure I can do it."

"Hopefully it will be a positive thing for us players. It's not an easy thing to stop."

Nearly 15% of boys in US high schools currently use smokeless tobacco and use is even higher among pupils who play organised sports than among non-athletes, according to a report by researchers at the University of California, San Francisco.

The use of smokeless tobacco increases the risk of cancer, gum disease and addiction to nicotine, the report states.

Player rep and pitcher Matt Cain, who does not chew, said he expects multiple discussions with the team to prepare players for the transition.

"The hard part is going to be policing it," he said. "It'll be interesting to see what they do about making it a policy."

Authorities say the ban on smokeless tobacco would be enforced the same way as regular smoking: by posting signs and removing offenders from premises.