The man was arrested early on Saturday morning at the main station in the Baltic Sea port city of Kiel, where he lived and studied.
Police shut the main train station in Kiel for five hours, saying the move was linked to the investigation into two unexploded bombs that were discovered in abandoned suitcases on trains in Dortmund and Koblenz in July.
The 21-year-old, identified as a Lebanese student, was detained a day after investigators released surveillance camera footage from July 31, the day of the attempted bombing, showing two men with heavy luggage who were believed to have planted the devices.
Prosecutors said the suspect was identified with the help of the video from Cologne station and DNA traces from one of the suitcases in which the bombs were found.
Chief prosecutor Monika Harms said he apparently had planned to flee the country, but she did not say where he wanted to go.
At a news conference in Wiesbaden on Friday, police said they were looking for two male suspects who were caught on video boarding the trains with the suitcases in Cologne.
The footage of the two men, aged between 20 and 30, was put on the internet to help the manhunt.
Middle East angle
Police have said the bombs - made with propane tanks, petrol bottles and crude detonating devices - may have been part of a plot designed to show anger over the Middle East crisis.
Along with the bomb materials, they found a bag of starch with Arabic print and a shopping list in Arabic for olives, bread and Lebanese yoghurt.
The bombs were fitted with timers set to go off 10 minutes before the trains arrived in the two cities. The explosives had been ignited but failed to detonate. If they had gone off, they would have killed a "high number" of people, the police said.
Germany has not suffered a major terrorist attack in recent years, although a cell including members of the group behind the September 11, 2002, attacks on the US was based in the northern port city of Hamburg.