People were told to stay indoors and rail services were suspended after the item was discovered on Thursday morning in Llantwit Road in St Athan, Vale of Glamorgan.
Residents were told to stay away from windows while officers attended the scene.
British Transport Police and Network Rail were also on the scene this morning when the item was found next to the Rhoose-Llantwit Major line.
Specialist officers have since dealt with the device, and transport services have returned to normal.
A spokesman for South Wales Police said: “Officers were called at 9.55am to an area of railway in St Athan following reports of a suspicious item found lineside.
“South Wales Police and Ministry of Defence attended and trains were put on stop while the item was assessed and area made safe.
“Enquiries are ongoing, and the line has now reopened.”