Take the local train to Irun and walk to the highway. At the border there is a toll-gate, where you can ask for lifts. It's easy to go to Bordeaux, France and it should also be possible to find a ride heading into Spain or Portugal.
A bit further, there is also a huge truck stop.