The UK Supreme Court has ruled that Scotland can set a minimum price for alcohol, rejecting a challenge by the Scotch Whisky Association (SWA).
Legislation was approved by the Scottish Parliament five years ago but has been tied up in court challenges.
In a unanimous judgment, seven Supreme Court judges said the legislation did not breach European Union law.
The judges ruled the measure was a "proportionate means of achieving a legitimate aim".
Ministers said a 50p-per-unit minimum would help tackle Scotland's "unhealthy relationship with drink" by raising the price of cheap, high-strength alcohol.
The whisky association had claimed the move was a "restriction on trade" and there were more effective ways of tackling alcohol misuse.
After the Supreme Court verdict, ministers are expected to make Scotland the first country in the world to establish a minimum price per unit of alcohol, possibly early next year.
A small number of countries, including Canada and Russia, have some form of minimum price structure, according to the Institute for Alcohol Studies.
Many others have rules aimed at restricting cheap alcohol sales.
Scotland's First Minister Nicola Sturgeon tweeted: "Absolutely delighted that minimum pricing has been upheld by the Supreme Court.
"This has been a long road - and no doubt the policy will continue to have its critics - but it is a bold and necessary move to improve public health."
The Scotch Whisky Association said it accepted the Supreme Court's ruling.
How does minimum pricing work?
The Scottish government's aim is to reduce the amount that problem drinkers consume simply by raising the price of the strongest, cheapest alcohol.
The move is not a tax or duty increase. It is a price hike for the cheapest drink, with any extra cash going to the retailer.
Last year, Alcohol Focus Scotland claimed the maximum recommended weekly intake of alcohol (14 units) could be bought for just £2.52.
It said super-strength cider and own-brand vodka and whisky could be purchased for as little as 18p per unit of alcohol.
The 50p-per-unit minimum outlined by the legislation would raise the price of the cheapest bottle of red wine (9.4 units of alcohol) to £4.69, a four-pack of 500ml cans of 4% lager (8 units) would cost at least £4 and a 70cl bottle of whisky (28 units of alcohol) could not be sold for less than £14.
Normal strength cider (5% ABV) would cost at least £2.50 a litre but a super-strength version (7.5% ABV) would have to cost a minimum of £3.75 for a litre.
Off-sales and supermarkets
Minimum pricing will not raise the prices of all alcoholic drinks because many are already above the threshold.
Pubs and bars are unlikely to be affected as they usually charge much more than 50p per unit.
The aim is to hit consumption of strong alcohol which is sold at low prices.
The new laws would be "experimental" and expire after six years unless renewed.
What the Supreme Court said
The judges at the Supreme Court rejected the Scotch Whisky Association's claim that an excise duty or tax would be an equally effective way of achieving the government's objectives.
Their judgment said minimum pricing targeted "the health hazards of cheap alcohol and the groups most affected in a way that an increase in excise or VAT does not".
The judges said a tax would increase prices "across the board" and not just the cheap, strong alcohol which is the focus of the legislation.
They also agreed that minimum pricing was "easier to understand and simpler to enforce".
Minimum pricing would not allow retailers to "absorb" the cost in the way a duty rise would, they said.
What has the reaction been to the verdict?
Scotland's health minister Shona Robison said: "This is a historic and far-reaching judgment and a landmark moment in our ambition to turn around Scotland's troubled relationship with alcohol.
"In a ruling of global significance, the UK Supreme Court has unanimously backed our pioneering and life-saving alcohol pricing policy."
Scotch Whisky Association chief executive Karen Betts said: "We will now look to the Scottish and UK governments to support the industry against the negative effects of trade barriers being raised in overseas markets that discriminate against Scotch Whisky as a consequence of minimum pricing, and to argue for fair competition on our behalf."
Scottish Conservative health spokesman Miles Briggs said the Scottish government would have his party's support on implementing the legislation.
He said: "We look forward to seeing whether or not minimum pricing can make any impact on Scotland's complex and damaging relationship with alcohol."
Alison Douglas, chief executive of Alcohol Focus Scotland, said the decision was a "massive victory for Scotland's health".
She said: "Minimum unit pricing is effective because it targets the kind of drinking most likely to lead to the greatest harm.
"The price of a pint in the pub won't change but the price of strong white ciders and own brand spirits that are mainly bought by dependent drinkers will rise markedly."
Dr Peter Bennie, chairman of the British Medical Association Scotland, said: "As doctors we see every day the severe harms caused by alcohol misuse and the damage it causes to individuals and their families.
"There are no easy solutions, but minimum unit pricing can make a significant contribution to reducing these harms and saving lives."
Cancer Research UK's cancer prevention expert Linda Bauld said: "Alcohol is linked to seven types of cancer including breast and bowel cancer, and the more you drink the greater your risk of cancer.
"It's a shame expensive legal action has delayed this welcome measure."
BBC Reality Check: Does minimum pricing work?
Canada is one of the very few countries to have brought in a form of minimum pricing for alcohol, where it's known as a "Social Reference Price".
Each of Canada's 10 provinces is able set the lowest price per litre that alcoholic drinks can be sold for in shops.
Canadian academic studies suggest that the policy has successfully reduced alcohol consumption.
According to research by Tim Stockwell at the University of Victoria's Centre for Addictions Research of British Columbia, a 10% increase in average minimum prices in one province led to an 8% decrease in alcohol consumption per person.
The price rise was also associated with a 9% decrease in patients being hospitalised for alcohol related diseases.
But other factors could also be contributing, such as the ageing population. Older Canadians tend to drink less, which might also explain the fall in consumption.
It is also difficult to draw a direct comparison between Canada and Scotland.
In Canada the extra revenue generated by the minimum pricing goes to the government rather than the retailers. This means retailers in Scotland may have an extra incentive to increase sales because they will profit directly.
Timeline: Minimum pricing for alcohol
The Supreme Court ruling was the final stage of a five-year legal battle, with the cases already passing through courts in Edinburgh and Luxembourg. After an initial challenge at the Court of Session failed in 2013, the SWA appealed to the European Court of Justice (ECJ).
The European court said the legislation might break EU law if other tax options would prove as effective, but said it was "ultimately for the national court to determine" whether they did.
The Scottish court subsequently backed the measures for a second time, ruling that tax measures "would be less effective than minimum pricing".
However, in December 2016 the Court of Session judges then allowed the SWA to go to the Supreme Court to challenge their ruling.
May 2012: MSPs pass Scots booze price plan
May 2013: Minimum drink price challenge fails
December 2015: Minimum drink price 'may breach EU law'
October 2016: Courts back minimum alcohol price
December 2016: Whisky firms allowed minimum price appeal
What's the situation elsewhere in the UK?
The UK government supported the devolved Scottish administration during the legal process, arguing that minimum pricing was compatible with EU law.
In 2012, then Prime Minister David Cameron pledged to introduce minimum pricing - but the plan was shelved a year later in the face of fierce opposition from the drinks industry.
The Home Office has said the policy remains under review and calls for its reintroduction in England are likely to be reignited when it is implemented in Scotland.
In Northern Ireland, former Health Minister Jim Wells had been seeking to introduce minimum pricing before resigning in April 2015.