Police in Barcelona said they were advised by security personnel in the city's main Sants station that "they had seen by scan an object that could be an explosive artefact", a spokesperson told AFP.
Most Spanish stations require passengers boarding trains to put their luggage through scanners.
Spain says it is still a target 10 years after train bombs
A photo of the luggage scan posted on the Twitter feed of Catalonia's Mossos police force showed what looked clearly like a grenade.
Police subsequently evacuated two high-speed trains at the Barcelona station but didn't find anything, the spokesperson said.
"Then we saw that this person could be in a train going to Madrid. We warned national police," he added.
In the Spanish capital, police said they created a security zone on part of a platform at Atocha station, which was the scene of one of Europe's worst terror attacks in 2004 when 191 people were killed in explosions on commuter trains.
Spanish train driver charged with 79 counts of homicide
When the train arrived, they checked the luggage and found that the grenade-like object was actually a "belt buckle", a police spokesperson said.
It is unclear why security personnel in Barcelona let the passenger get onto the train if they were worried about the potential grenade.
Adif, Spain's state company that manages stations and rail infrastructure, told AFP they were looking into the incident.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ