Due to the vagaries of international transportation agreements (and the fact they have different train gauges), getting TO Portbou can only be done from France on an SNCF train. The SNCF train then turns around and returns to France (Cerbere) without (officially) loading any passengers. To return to France from Portbou, you'll need to catch a Renfe coming from Barcelona and terminating at Cerbere, the first station in France. This (Renfe) train then returns to Portbou without (officially) loading any passengers. Note that the same applies at the other end of the Pyrenees with Hendaye and Irun.
If you feel tempted to catch either of the Talgo trains ('Catalan Talgo' or 'Mare Nostrum') running on this route, don't ! A single fare from Portbou to Cerbere or vice versa will cost you €23. A 'normal' train will cost €1.40 or thereabouts.
If you feel tempted to walk from Cerbee to Portbou (not all trains to Cerbere carry on to Spain, for instance), bear in mind that although, via the tunnel, it's only 2 kilometres, by road it's closer to 7km, because the (very steep and twisty) winding road goes up via a headland - the views from which over the 2 bays are marvellous, but not something to be attempted with luggage or without a bottle of water. There are apparently taxis available to waft you from one place to another, but I didn't see any at either station, and they know that they are the only show in town and charge accordingly. Note also that, although you can buy tickets from French stations to Portbou, and Spanish stations to Cerbere, you (generally) can't buy tickets from France to Spain and vv., unless they are on the aforementioned 'Catalan Talgo' or 'Mare Nostrum' trains. If you want to go further on than Portbou from France or Cerbere from Spain, you can only buy tickets to the border, and then need to go to the ticket office in each to buy your tickets. At Cerbere there is a ticket machine in addition to the woman selling tickets. At Portbou, there's just a desk.
All of the latter will probably change when the Perpignan - Barcelona TGV starts, but note this will not be taking this route.
Port Bou is a charming little resort at the French/Spanish border , ideal if you on a long journey and need to pause for a bit. Barcelona is 2 and a half hours by RENFE train and Paris is about 6 and a half hours by SNCF train. Port Bou also fine for a stop if travelling by car. The railway station is huge a relic from the days when Port Bou was an important border station.