The restriction will take effect from July 20 on all ScotRail trains operating between 9pm and 10am.
Last night the move was welcomed by politicians and police, despite a public consultation revealing public opinion is divided on the issue.
Rail watchdog Passenger Focus warned the ban could be difficult to enforce, and was likely to target thousands of responsible passengers as well as a minority who caused a nuisance to fellow travellers.
ScotRail, which operates more than 95% of passenger services in Scotland, said the ban would send out a "clear message" to the small minority of passengers that anti-social behaviour on trains and at stations was unacceptable.
The restriction will not apply to ScotRail's cross-border Caledonian Sleeper service, or the east and west-coast services offered by other operators between Scotland and England.
Steve Montgomery, ScotRail's managing director, said the ban would help passengers travel in a "safe and friendly environment".
He added: "It's time to call a halt on the irresponsible minority who spoil journeys for the majority.
"These individuals disrupt services, abuse staff and fellow customers, and cause accidents."
ScotRail already runs a number of "dry trains", with temporary alcohol bans in place, around major sporting events and concerts, but this would be the first major roll-out of such a ban in the UK.
A Government consultation on the future of Scotland's railways published last November invited views on a blanket ban of alcohol on train services but received a mixed response, according to analysis published earlier this week.
Among the 1283 responses received, including 173 from organisations, there was a "sizeable number" in favour of a total ban on alcohol consumption but a similar number who supported a more detailed analysis into the link between alcohol and anti-social behaviour, the analysis found.
It similarly identified "considerable support" for the existing system of banning alcohol on trains travelling to and from major sporting events and concerts. "Many respondents thought that this struck a sensible balance between no restrictions on alcohol consumption and a total ban," it added.
Robert Samson, spokesman on ScotRail services for Passenger Focus, said a ban on alcohol was "down the list" of priorities identified by passengers.
"It's going to be difficult to enforce. If passengers are getting on a train from Aberdeen to Glasgow or Edinburgh at 8pm, are you going to let them drink up until 9pm then stop them?" he said. "Passenger Focus's research on this issue has shown that passengers are concerned about anti-social behaviour.
"But their top priority is stopping drunk people getting on trains and their second priority is having a more visible police presence. A ban on alcohol is only fourth or fifth in their list of concerns."
ScotRail said last night it had conducted its own research on the issue last week which found that 84% of 1000 people polled supported a ban on alcohol after 9pm.
A spokesman said a publicity campaign over the next month would seek to raise public awareness of the ban and the first fortnight of its implementation would see a "softly, softly" approach as passengers got used to it. He stressed that no bags belonging to customers would be searched before or during train journeys.
Onboard trolley services will stop serving drinks at 8.30pm and passengers will be asked to stop drinking from 9pm, the spokesman said.
Chief Superintendent Ellie Bird, Scottish area commander for the British Transport Police (BTP) welcomed the initiative, saying there was a "well-documented" link between alcohol consumption and anti-social behaviour.
She said: "All passengers and rail staff have the right to travel unhindered and without the threat of encountering any kind of criminality. The enhanced restrictions will go a long way to helping reduce the opportunity for disruption."
Liz Cameron, chief executive of Scottish Chambers of Commerce, also welcomed yesterday's announcement. She said: "The ban will improve perceptions as well as make travel more pleasant for the vast majority of Scottish rail passengers.
"In turn, this will boost Scottish business – in particular, by encouraging more shoppers and families as well as leisure travel and tourism."
BTP did not have figures for drink-related incidents but said overall crime on the railways fell by 5% last year and was at its lowest level for eight years.
A spokesman for ScotRail said a review conducted by the train operator had revealed 260 occasions in the past six months when BTP responded to drink-related incidents.