MPs in Lagos state, Nigeria's economic hub, have passed a bill banning smoking in public places, including restaurants and on public transport.
Those who ignore the ban could face a $62 (£38) fine or up to three months in jail or both.
The bill also makes it an offence to smoke in front of a child - offenders will be fined $94 or be sentenced to a one-month jail term or both.
Lagos has already banned drivers from smoking to promote road safety.
Lagos is one of Africa's biggest cities, with a predicted population of 12 million in 2015, according to the UN. Lagos state says it has about 21 million inhabitants.
The smoking ban will only come into force once the state's governor, Babatunde Fashola, signs the bill into law.
The BBC's Tomi Oladipo in Lagos says smoking in public places is already prohibited by the federal government but this is loosely implemented.
In Lagos, smoking is popular in bars, beer gardens and nightclubs, he says.
BBC Hausa editor Mansur Liman says Lagos has long had a reputation of being a chaotic and disorderly city.
But he says that under Mr Fashola, a series of measures have been introduced to clean up the city - the latest being this ban.
The new bill stipulates that the owners or overseers of public areas will have to ensure that no-smoking signs are prominently displayed.
Failure to do so will mean a $627 fine or six months in prison.
Anyone who repeatedly contravenes the smoking ban would also be liable to a six-month prison sentence or $313 fine or both.