If you travel down the Mediterranean coast from France to Spain, Portbou is the first town over the Spanish border. The short train trip from Cerbère (in France) to Portbou is through a tunnel in the mountain and takes 4 minutes. If you drive the winding road over the mountain, it takes about 20 minutes (somewhat longer if you suffer from vertigo). If you have no problem with heights, the views are incredible (take a look at some of my other photos). The motorway (which is further inland), bypasses the coast altogether and heads straight down to Barcelona.
As ridiculous as it may seem, there are only 3 trains a day from Cerbère to Portbou: 14:24, 18:08 and 20:07. These run 7 days a week. There is talk that the coastal train will close when the TGV line from Perpignan to Barcelona opens in a year or two.