Funding of £325m has been secured to enable the Scottish Executive to take over responsibility of Scotland's railways.
Scottish ministers will be responsible for Scotland's railways
Under the new Railways Bill, powers are being transferred to the executive from the Department of Transport.
First Minister Jack McConnell said: "This is the most significant devolution of new powers to Scottish ministers since 1999."
First ScotRail welcomed the move saying it would bring long-term benefits.
Scottish ministers will soon have the power to determine Scottish railway strategies, manage the ScotRail franchise and specify rail infrastructure needs.
It will also be able to set fares and fund improvements.
However, under the bill, which is currently before Westminster, safety matters and the licensing of railway operators will remain reserved.
The funding announcement will also ensure that improvements at Edinburgh's Waverley station can go ahead.
UK Transport Secretary Alistair Darling said: "As I set out in last year's Rail Review, the Scottish Executive is to be given more power in determining its railway strategies and managing rail franchises.
"It is clear that the executive is best placed to decide what is right for Scotland's railways.
"The significant funding transfer I am announcing today will enable the executive to carry out its new powers effectively and represents the government's long-term investment in, and commitment to, the railways."
Mr McConnell said: "The substantial funding will allow progress on, amongst other things, the first phase of the Waverley redevelopment."
Scottish Transport Minister Nicol Stephen said: "This is a good deal for Scotland.
"These new powers and funding will allow our new transport agency to deliver our ambitious programme for improving the rail network. We want to work closely with the rail industry to provide a better deal for passengers."
A spokesman for First ScotRail said: "First ScotRail supports this devolution of rail responsibilities to the Scottish Executive and believes it will bring long term benefits to Scotland's railways.
"With these new powers, and the new Transport Scotland agency, there is now an excellent framework for the future strategic planning of rail services with a Scottish focus.
"First ScotRail is looking forward to working with all rail industry partners to deliver improvements for Scotland's rail users."
Scottish Liberal Democrat transport spokesperson Iain Smith welcomed the move and said it would help to develop Scotland's rail network.
The Scottish Parliament is to consider the use of a Sewell Motion on the bill, the process whereby Westminster can legislate on Scotland's behalf.