The investment figure was set by the then Scottish Executive in October 2004 when First ScotRail was awarded the franchise to run the country's trains.
The target was to do it in seven years and ScotRail bosses have now been praised for their achievement.
Stations have undergone extensive repairs and improvements, from customer information systems to toilets, waiting rooms to shelters.
Safety features have also been introduced, including CCTV.
In Glasgow, a new ticket office counter with raised and lower positions was installed at Queen Street Station, along with a new toilet for the disabled.
Five other city stations were given major upgrades that included ticket vending machines, cycle hoops, platform clocks and automatic gates.
Ten stations have opened, especially in a number of Lanarkshire communities, including Gartcosh and two in Larkhall.
Residents of Stewarton, Ayrshire, also got a double boost from the changes.
A £28.5million plan to improve rail runs between Kilmarnock and Glasgow saw the hourly service replaced by a half-hourly service.
Twice as many trains as before now stop at Stewarton, which also saw the re-introduction of a rail line with Lugton. Stewarton also got a park-and-ride car park as part of a scheme funded by the Scottish Government.
The First ScotRail network is a mixture of long-distance, commuter and rural lines, totalling more than 1700 miles and the operator has spent £20m on station upgrades.
Another £28m of funding on station enhancements has also come from Transport Scotland, Network Rail, Regional Transport Partnerships and local councils.
ScotRail also spent another £20m on major train and depot refurbishments, while staff numbers have increased 25% and £1.5m has been spent every year on staff training.
Scottish Transport Minister Keith Brown said: "I am pleased to see ScotRail achieve its commitment to reinvest £40m into improving the journey experience of rail users."
Steve Montgomery, ScotRail's managing director, said: "We have delivered on our franchise commitment."
ScotRail, which has had its franchise extended to November 2014, has promised to continue an investment programme.
A spokeswoman said: "The extension established an investment fund of up to £70m towards new services and facilities."
The rail boost comes just 24 hours after the Evening Times revealed Virgin Trains was to introduce three new 600-seat "tilting" Pendolino trains on the Glasgow-London West Coast Main Line route to relieve overcrowding.
And 31 of the existing trains will be lengthened, making an 28,000 extra seats available for journeys each day.