Barcelona makes a superb base from which to turn pilgrim, hop aboard trains and explore the magnificent surrounding region, says Simon Calder

Through the past, darkly: I first encountered the railways of Catalonia in January three decades ago, on a journey between the Pyrenean town of La Tour de Carol and Barcelona. The French station of La Tour de Carol enjoys some celebrity among railway enthusiast for being the meeting point for three different gauges: Iberian (to Barcelona), standard (to Toulouse) and narrow (towards Perpignan). But after the feeble sun had set over the cracked teeth of the Pyrenees, it was too dark to notice much besides eerie pockets of vapour rising through the bitter cold, presenting an almost Victorian backdrop for we hunched, shivering travellers.

Since then, the sun has come out: Catalonia has been reborn, and I have learned that to make the most of the region's remarkable railways you should choose a fine day.

My most recent travels began on the Mediterranean, at Portbou - which is where Spain starts for rail travellers from France. Surely one of the great travel bargains of Europe is the €12.60 (£9.70) run from here to Barcelona, 160km of drama - with plenty of worthwhile stops along the way.

The first stretch clings as close as the engineers dare to the Costa Brava, with coves popping into vision on the left, served by small, neat stations. The only thing wrong with the first notable stop is the name - but given the picture of prettiness, it is easy to see how you could fall in love in the town of Colera.

Next along, Llança is the point at which you would branch off (by road, sadly, not rail) into Salvador Dalí country, with a short and winding road to his adopted home of Cadaques . Stay on the train, though, and in no time you find yourself arriving in Figueres, which would be just another sleepy Catalonian market town - were it not for the influence of the moustachioed man of magic. A cinema has been triumphantly converted into the Dalí Museum; check in your concept of reality at the door, and check out the shocking contents from giant Mae West lips to a limousine rotting from the tyres up.

For the next stretch, do yourself a favour and sit with your back to the direction of travel. The reason: the line plies through tranquil terrain, but directly behind it the Pyrenees rise up, a reminder of the natural barrier that separates Iberia from the rest of Europe.

Ah, Girona: for many of the pioneering package tourists to the Costa Brava, the airport was all they saw of one of Spain's great cities. Even now, the propensity of a well-known no-frills airline to describe it as "Barcelona" unkindly deflects attention from a handsome, moody and profoundly historic city. Climb the well-preserved walls, explore the old Jewish quarter and marvel at the almost Venetian perfection of the riverside mansions. Then - after a slug of the coffee that propels you through so many fine Spanish days - head back to the elegant modern station for the run to Barcelona.

One branch turns south-east to the sea, but the main line cuts through scenery on a grand scale. To the left, the Parc Natural del Montnegre celebrates the 773m peak of that name, while to the right the pre-Pyrenean massif of El Montseny climbs to 1,700m.

The final approach to Barcelona is as prosaic as you would expect, but where you make landfall in the city is crucial. Trains from the north serve Estació de França - but many of them arrive at the underground station, on their way through to the main hub of Barcelona Sants. If this happens to you, get out and climb to ground level for the magnificent sweep of steel and glass - see page ix.

Barcelona has many attributes as a city, but one of its least celebrated is as a base station for trips out of town by rail. One of the easiest yet most spectacular is Montserrat, accessible (just) with a train from Barcelona's Plaça d'Espanya to Aeri de Montserrat. Transfer to a cable car for the 10-minute trip hundreds of metres high to a cleft of a mountain. A monumental basilica has been hewn out of the golden sandstone. From ground level it looks like a piece of confection placed in a great loaf of a mountain. Close up the basilica is a piece of architecture that would impress at ground level. The temple was established here 400 years ago because of a small, dark carving of the Madonna and Child. The Black Virgin - dating from the sixth century and blackened through age - is revered all over the Catholic world. The delicate expression gazes upon pilgrims who queue to kiss her right hand.

You can also make this trip with a special train, the Tren de Cremallera de Montserrat, and the rack railway - see page 14. On whichever train you choose, and whichever level you choose, a trip here is an uplifting experience.

A religious expression is used, wholly inappropriately, for another easy-to-reach excursion from Barcelona: Sitges, "a gay mecca" (sic) according to one guidebook. Whatever your inclination, this is a lovely Mediterranean resort with a broad sweep of sand, a cosmopolitan atmosphere and a tempting array of cafes tucked around the cliffside church. The journey there is a treat in itself: a cliff-teetering journey, best experienced in late afternoon when the dwindling sun heightens the drama. A sequence of pompous but small palaces prepare you for the treat of its old station.

The trains south from here helter and skelter at speeds that feel like 120km/h or more - faster than the autopista. Many of them are double-deckers, revealing backyards, beaches, raw coastline, a yacht marina in Vilanova i la Geltrú, and finally the town of San Vincenç de Calders - one of those junctions that is difficult to avoid on any Catalonian exploration. The choices are substantial: turn inland for Lleida, itself the gateway to many more of Spain's attractions. What was once a slumbering minor city now finds itself catapulted to 21st-century prominence; it is astride the fast line from Barcelona to Madrid, with some trains venturing all the way to Andalucía; the old line to Zaragoza still carries those with time and appreciation of good things along the meandering Ebro valley to the home of Expo 2008; and a branch highly rated by Messrs Thomas Cook climbs to La Pobla de Segur, base station for many a Pyrenean adventure. My choice was to walk through Lleida to the other end of the city centre and pick up a bus run by the Catalan government all the way to Val d'Aran - a piece of Catalonia that is, geographically, the French side of the watershed.

But this is about Catalan trains, and so you should really stay on board to Tarragona - where a slab of Roman masonry greets arrivals to the main station. From here you can walk up to the most spectacular viewpoint over the Mediterranean in five minutes; just turn right out of the station, follow the road and climb the steps to a road that will take you to the high point.

In Roman times, Barcelona was a mere out-station to the city of Tarraco. The modern successor, Tarragona, drapes itself over a healthy collection of Roman remains - including an impressive Forum. Tarragona is an ideal antidote to its bigger rival for people who want a relaxed, low-budget city stay in Catalonia. Yet it has also been catapulted into the forefront of the railway age this year. A 20-minute bus ride up into the dusty hills will deposit you at Camp Tarragona - no, not another "gay mecca", but a stupendously conceived station devoted to the latest high-speed trains. Now, the Spanish capital is two hours away; Barcelona 30 minutes; and soon, Paris will be just an afternoon away. Catalonia has been catapulted to the heart of Europe's great railways, and offers journeys to match.

Longhaul by rail: London, Paris, Madrid, by 'the man in seat 61' by Mark Smith

Catch a train all the way to Spain? Surely I'm kidding? Well, taking Eurostar to Paris and the overnight "trainhotel" to Spain makes a great alternative, with less impact on the environment (and potentially, on your blood pressure) than 21st-century aviation.

The journey starts in mid-afternoon at St Pancras station. Treat yourself to a glass of bubbly at Europe's longest champagne bar and let the beautifully restored station take your breath away. There's an easy 30-minute check-in before you board the Eurostar for the journey across Kent and northern France at 186mph.

Two hours and 20 minutes later, Eurostar arrives at Paris Gare du Nord. Take a taxi or metro to the Gare d'Austerlitz, where the trains to Spain await. Two Spanish trainhotels leave Paris every night, the Francisco de Goya for Madrid at 7.43pm, and the Joan Miró for Barcelona at 8.32pm. Run by Elipsos, these special articulated sleeper trains have compact but cosy bedrooms, a restaurant and cafe-bar. "Turista" sleepers have four berths per compartment, "Preferente" one or two, while "Gran Clase" comes with one or two berths and a private shower and toilet.

After departure, dinner awaits - included in the Gran Clase fare, extra for other passengers. The trainhotel gathers speed through French provincial towns, traffic lights glinting off the rain-drenched streets outside, as your waiter pours a pre-dinner aperitif of excellent sherry or cava. By the time your main course arrives the train is deep in the French countryside, picturesque villages and ancient churches swishing past in the moonlight. After coffee and liqueurs, you head back to your sleeper to find that the attendant has folded the seats away and made up your beds.

Next morning, wake up in Spain. The train has seamlessly crossed the frontier, its adjustable axles coping with that pesky difference in track gauge. Breakfast is served in the restaurant car, included in Gran Clase and Preferente fares. On the Francisco de Goya, the morning sun bathes the restaurant in a warm red glow as it rises over distant snow-capped mountains. Look out for the Spanish royal palace at El Escorial, about 40 minutes before Madrid. Step off your trainhotel at Barcelona's França station at 8.24am or Madrid's Chamartí*station at 9.13am. It's the most civilised way to arrive, and the other great cities of Spain are just a short train ride away...

London to Paris by Eurostar starts at £59 return standard class or £149 first class.

Paris to Madrid or Barcelona starts at £54 each way including a bed in a Turista 4-berth sleeper, £82 each way including a bed in a Preferente 2-berth sleeper and breakfast, or £117 each way with a bed in a Gran Clase 2-berth sleeper with shower/toilet including dinner with wine and breakfast. Children under 5 free.

See or call rail Europe on 0844 848 5848.