Network Rail has said it will not close the level crossing at Llandrindod Wells, but has promised instead to renew the infrastructure and install additional safety features.
Network Rail has a legal duty to review all level crossings and some in Powys County Council had suggested closing the crossing.
There had been widespread opposition to the move due to the impact it would have on access to the towns amenities.
Kirsty Williams, Welsh Liberal Democrat AM for Brecon and Radnorshire, said: “I am pleased that common sense has prevailed. To close this crossing would have cut the town in half, affecting people’s access to the businesses on Tremont Road and access to the Primary School and Hospital.
“When the announcement was made I had had several meetings with network rail to express my concerns about the impact the closure would have on the town. I felt that the speed and number of trains on this line means that a safe level crossing is perfectly viable. I am pleased there will be improvements to the safety of the crossing.
“I am grateful to the hundreds of people who signed my petition, wrote letters and attended public meetings. The public response to these proposals helped to make the campaign a successful one.”