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.
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.
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.
Network Rail say the go-ahead for rail electrification in the Valleys will mean a better train service and boost the Welsh economy.
Arriva Trains Wales has responded to today's announcement that the UK Government will pay £230 million towards electrifying the Valley Lines.
Arriva Trains Wales says a strike, due to hit services in North Wales, has been called off.
Members of the RMT union, at three depots including Holyhead and Llandudno Junction, were due to walk out tomorrow and Friday.
Talks will resume to resolve the dispute.
Flooding means there are no trains running between Blaenau Ffestiniog and North Llanrwst. There are replacement buses.
There are delays of up to 15 minutes on Arriva Trains Wales between Treherbert and Cardiff Central, between Aberdare and Cardiff Central and between Merthyr Tydfil and Cardiff Central because of over running engineering works at Pontypridd.
Network Rail says there was a derailment in the early hours of this morning at Porthkerry in the Vale of Glamorgan.
Two wagons of a freight train came off the rails and accident investigators are at the scene.
Nobody was hurt but services between Bridgend and Barry have been suspended. A bus service has been introduced.
There is no word yet on when train services will resume.