The US already has a rapid reaction force of about 800 troops at Moron de la Frontera, near Seville, who were deployed temporarily in the wake of the 2012 attack on a US mission in Benghazi, eastern Libya.
The upper house of parliament, which is controlled by the governing conservative PP party, approved by a large majority an amendment to a Spain-US defence treaty to increase the force and make it permanent.
The Senate's approval was the last legislative hurdle the amendment needed to clear before becoming law.
The Spanish government said in May that 2,200 Marines plus 500 civilian staff would man the base, with 26 aircraft. It will also have capacity to receive 800 more military personnel and 14 aircraft on temporary deployments.
The two countries signed the accord in June, amending a 1988 defence partnership.
The main mission of the Special-Purpose Marine Air-Ground Task Force Crisis Response unit will be to protect US embassies in Africa, evacuate civilians in difficulty, or intervene in conflicts or humanitarian crises.
It will come under the US military command for Africa (AFRICOM) which is based in Stuttgart, Germany.
The US Ambassador in Spain, James Costos, thanked Spain for hosting the base which he said "governs our cooperation in the defence of our two nations", in a statement on Tuesday.
He said the base "protects citizens and facilities of the United States, Spain, and other NATO Allies in Africa, Europe, and the Middle East".