Drinking will no longer be allowed in any trains or stations between 9pm and 10am. The move is aimed at tackling anti-social behaviour.
British Transport Police have also promised a tougher approach to preventing drunk people getting on trains.
The drink ban will not apply to the overnight Caledonian sleeper to London, which is regarded as a “hotel on wheels”.
Transport police have dealt with 260 drink-related incidents in Scotland in the past six months, with an increasing number of trains being delayed as a result.
From tonight, train catering trolleys will stop selling drink from 8.30pm and customers will be asked to finish any alcoholic drinks by 9pm.
Alcohol was already prohibited on certain services carrying people to football and rugby matches and other events.
ScotRail said it would take a “softly, softly” approach to the ban for the first two weeks to allow passengers to get used to it. Passengers’ bags will not be searched.
The Scottish Government has welcomed the ban, but rail watchdog Passenger Focus claimed it could prove unenforceable and penalise people who were not causing any problem.
Meanwhile, Health Secretary Nicola Sturgeon has accused the whisky industry of putting profits before public health after it confirmed plans to mount a legal challenge to the new minimum pricing law.
The Scottish Whisky Association is lodging a complaint with the European Commission and pursuing action through the Court of Session over the Scottish Government’s plans to introduce a minimum price of 50p per unit of alcohol.
The SWA’s complaint to the EC centres on the argument that minimum pricing breaches EU trade rules. It says the measure would artificially distort trade in the alcoholic drinks market, contrary to EU law.
The action at the Court of Session argues that minimum pricing breaches the UK’s EU treaty obligations and exceeds the Scottish Parliament’s powers under the Scotland Act 1998 because the price of goods and services is a responsibility reserved to Westminster.
Ms Sturgeon said the Government would “vigorously defend” the legal challenge. She said: “Minimum pricing will save lives and reduce the harm caused by alcohol misuse. It is a targeted policy and will not penalise those who drink responsibly.”