Algeciras is an industrial port-city in southern Spain, in the region named Andalucia. It is one of the main ferry crossings to Tanger, Morocco, and from which it is often possible to hitchhike with truckers ("camioneros") onto a boat to Morocco, without having to pay a ticket. Many drivers have the right to bring a passenger along with them, so it is both legal and free for them to take you along. Before hand, you will see many trucks waiting in the many parking lots surrounding the port. The easiest way to find a ride is to simlpy ask, and continue asking everyone you see until you´ve found someone who is leaving on the next boat. The last ferry of the night departs around 10 PM, and each ferry loads about an hour before departure. So, to be on the safe side, you should arrive no later than 8PM (20.00) if you´d like to try for the last ferry of the night.
Customs and border crossing patrol will take place on the ferry. You should bring your passport and a pen to fill out the form that you will be given. Sometimes, you have to ask the staff for guidance, since the border personnel expect you to come to them, rather than for them to come to you. You should take care of all passport-stamping before the boat arrives in Tanger because you will have to present your stamped passport page to the authorities before leaving the port.