David Cameron was shown the busiest section of railway in Wales, near Cardiff Central station, where the electrification of the Great Western main line and the Valleys lines will intersect.
The Prime Minister was shown round by Mark Langman of Network Rail Wales.
The Welsh Liberal Democrats say the decision to hand control of the Wales and borders rail franchise to the Welsh Government demonstrates their influence in the Westminster coalition. But Plaid Cymru say the railway track itself should have been brought under Welsh control.
Today's announcement is a landmark as it means decisions on Welsh train services will now be made in Wales. The fact that this power closer to the people of Wales shows just how strong the Liberal Democrat influence is in the Wales Office.
Until now, the Governments at either end of the M4 have been able to pass the buck between them over who is to blame when things go wrong. Now we will know absolutely where responsibility lies for making improvements to services and giving Wales the trains it deserves.
The Welsh Government have less than four years to decide what all of Wales needs now and in the future, run a franchise competition, select an operator and then ensure they have the trains they need to deliver decent services. This will be no mean feat, but with matters resolved and commuters knowing where to look for answers, our rail services will be properly accountable at last.
Eluned Parrott also said she was "absolutely delighted" that the Welsh and UK Governments had resolved the funding of Valleys lines electrification. Plaid Cymru's spokesperson, Rhun ap Iorwerth also welcomed it as a "good step in the right direction" but said his party would continue to argue for complete Welsh control of the railway.
Plaid Cymru welcomes the devolution of the rail franchise. For the first time, Wales will be able to choose who operates its own railway. This is something that our party has underlined the importance of for several years. The current and next Welsh Governments now have an enormous challenge in planning and delivering the next franchise, but this is a challenge that we know can be reached.
Plaid Cymru believes this must lead to more areas of the country being opened up to rail services, and that work on this must begin as soon as possible.
Previous Secretaries of State appeared to want Wales to pay the full cost of Valley Lines electrification. They have rowed back on this and have reached a deal. The deal itself is a good step in the right direction but it still appears to leave control of rail infrastructure in the hands of Westminster. We would prefer to see both franchising and infrastructure in Welsh hands so that they can be planned together, and will continue to press on that issue.
The Welsh Conservatives have blamed a lack of attention to detail by Labour ministers when Valleys rail electrification was first announced for the row over money that put the entire project at risk. Originally the UK government expected the entire £460 million cost to be repaid by the Welsh Government, primarily by increasing train fares.
Under the new deal announced today the UK Government will contribute £230 million to the scheme, though the rest of the money will still have to be repaid.
This deal will have a hugely beneficial impact on the lives of tens of thousands. It is a massively important investment that puts Wales first, prioritises infrastructure and transport, and provides a hugely welcome boost for business.
Labour didn't electrify an inch of rail track – and their mistakes and lack of attention to detail led to the circumstances preceding today’s solution. In stark contrast - this announcement is the real action Wales needs.
I wholeheartedly welcome the hard work of Conservatives in Wales in securing a pivotal and life-changing deal for our communities. From Newport to Swansea and - crucially, into the Valleys - this is what the region needs to secure growth and move forward.
Network Rail say the go-ahead for rail electrification in the Valleys will mean a better train service and boost the Welsh economy.
Electrification will transform the railway in south Wales, making journeys faster, more reliable, greener and quieter. An electrified railway will also help support economic growth by creating jobs and boosting the supply chain when work is undertaken, as well as providing a building block for future growth. It will help reduce journey times and boost commuting opportunities, making Wales a better place to do business.
Arriva Trains Wales has responded to today's announcement that the UK Government will pay £230 million towards electrifying the Valley Lines.
Electrification will bring many benefits including quicker journey times, reduced running costs, lower carbon emissions and the replacement of the current rolling stock on this part of the network which is nearing forty years old.
This important investment builds on the huge growth we have already seen in Wales over the past 10 years and is a great recognition of the importance of rail services in Wales.
The UK Govt has today agreed to pay £230 million -half the estimated total cost- towards electrifying the Valleys lines.Read the full story ›
New Welsh Secretary Stephen Crabb turns to one of the items at the top of his in-tray today -the row between the Welsh and UK governments over who pays for the electrification of the Valley lines. Ministers in Cardiff Bay say Mr Crabb's predecessors, Cheryl Gillan and David Jones, were quick to claim the credit for the giving the multi-million pound project the go ahead, so there's no way that the bill should be passed on.
Today Mr Crabb will hold talks with this cabinet colleague, the Transport Secretary, Patrick McLoughlin. The Transport Department argues that as the Welsh Government manages the Wales and Borders rail franchise, it should be responsible for repaying the cost. That would mean either funding a bigger subsidy or putting up the fares.
Only yesterday, the Prime Minister defended what he saw as a done deal but ITV news understands that there might at least be a concession over how quickly the money needs to be repaid. A senior Welsh Government source was also optimistic that the dispute could soon be settled.
Following today's meeting between the Welsh and UK Governments in London, Carwyn Jones says he's willing 'to meet some of the incidental costs' of rail electrification in the South Wales Valleys.
But in a sign that this dispute is far from over, he told Political Editor Adrian Masters that 'we're not paying for the whole thing, there's no chance of that.'
The First Minister has challenged the UK Government to publish documents it says prove the Welsh Government agreed to pay the costs of rail electrification in the South Wales Valleys.
Carwyn Jones was speaking to Political Editor Adrian Masters following a meeting in London of the Joint Ministerial Committee which brings together leaders of the devolved nations, chaired by the Deputy Prime Minister Nick Clegg.
Both sides in the rail electrification costs row remain polarised, if you'll forgive the pun, after today's Joint Ministerial Council meeting. A Whitehall source said it seemed the First Minister had 'picked a fight to hide his embarrassment' about an agreement, the existence of which he disputes.
For his part Carwyn Jones has challenged the UK Government to produce any document which would prove a deal. Until now the correspondence has only been semi-leaked but I understand there are moves to try to publish it.
The First Minister says he'll consider paying for some 'incidental costs' but not the full costs. He also told Nick Clegg that one solution would be to devolve responsibility - and the funding - for rail to Wales immediately. Neither side show any signs of backing down.