The sale of tobacco from vending machines has been banned in England, with anyone caught selling cigarettes in machines facing a fine of £2,500.
The Department of Health said the ban had been introduced to prevent under-age sales to children and to support adults who were trying to quit.
The rest of the UK is expected to implement a similar ban next year.
Some pub landlords say it is a further threat to a livelihood that has already been damaged by the smoking ban.
But Cancer Research and the British Heart Foundation have welcomed the move.
According to the Department of Health, nearly all adult smokers started smoking before they turned 18.
Of the children who regularly smoke, 11% buy their cigarettes from vending machines.
It is also estimated that 35 million cigarettes are sold illegally through vending machines to children every year.
Under the new rules, pub landlords will still be able to sell cigarettes from behind the bar but they must ensure all tobacco advertising on vending machines is removed. Any person found guilty of displaying cigarette adverts on a vending machine could face imprisonment for up to six months, a fine of £5,000, or both.
Health Secretary Andrew Lansley said smoking was “one of the biggest and most stubborn challenges in public health”, with more than eight million people in England still smoking, causing more than 80,000 deaths each year.
He said: “Cigarette vending machines are often unsupervised, making it easy for children to purchase cigarettes from them.
“The ban on cigarette sales from vending machines will protect children by making cigarettes less accessible to them - we want to do everything we can to encourage young people not to start smoking in the first place.”
Jo Butcher, the National Children’s Bureau’s programme director of health and wellbeing, welcomed the ban and said a person’s lifetime smoking or non-smoking behaviour was “heavily influenced” by decisions in their adolescence.
“Children and young people tell us that external influences make it even more difficult for them to choose healthier lifestyles.
“It’s essential that we create environments that improve health and tobacco legislation is an important part of public health protection and promotion,” she said.
Charities have also welcomed the ban.
Betty McBride, director of policy and communications at the British Heart Foundation, said thousands of children at risk of this “deadly addiction” regularly got tobacco from vending machines, “which conveniently don’t ask them to prove their age”.
“These children are often blissfully unaware of the damage smoking does to their health and, by the time they realise, they’re hooked.
“Scrapping these machines cuts off an easy source of tobacco for existing young smokers and makes it harder for a new generation to start.
“We’re encouraging landlords to remove machines completely now so they - and any left-over branding - don’t act as dusty old adverts for tobacco,” she said.
Eileen Streets, director of tobacco control at the Roy Castle Lung Cancer Foundation, said she hoped the ban would play a “significant part in stopping many children becoming the next generation of lung cancer victims”.
Jean King, of Cancer Research UK, added: “Tobacco kills half of all long-term users and is responsible for one in four cancer deaths.
“Cancer Research UK is determined to protect children from tobacco marketing and through our Out of Sight Out of Mind campaign we are continuing to work for legislation to introduce plain packaging for cigarettes.”
But the British Beer and Pub Association described the ban as “an unnecessary measure”.
A spokesman said the machines were there for the convenience of adult customers, and that the association did not believe they played a role in childhood smoking.
Although cigarettes can be sold by bar staff, the spokesman said many pubs would not opt to introduce that, as it raised issues about having a “high-value” item behind the bar and interfered with serving drinks.
One London pub landlord, Bill Sharp, said the ban was another “nail in the coffin” of his livelihood.
“I can understand them removing it from public places because that’s a view, a health issue, call it what you will.
“But when [smokers have] got to stand in the street and they can’t even buy their cigarettes in the pub, then where is it left? There’s no point in them going to a pub. They going remove real ale from pubs next?”
Other measures to protect young people from the dangers of smoking are also on the way.
In April 2012, large retailers in England and Scotland will have to get rid of all tobacco displays. Small shops will be expected to comply from April 2015.
Wales and Northern Ireland plan to implement similar regulations.
The government is also due to begin a public consultation before the end of the year on whether to introduce plain packaging for cigarettes in order to lessen their marketing appeal to young people, help make health warnings more effective and help reduce the number of smokers.