During the winter of 1340, Abu Hasan gathered his fleet: 100 war galleys concentrated at Ceuta under command of Muhammad ibn Ali al-Azafi. They landed an army at Gibraltar, and on 1 April 1340 they met the Castilian fleet (32 galleys and 6 naos, under Admiral Alfonso Jofre de Tenorio) in the straits. Al-Azafi surrounded and destroyed the Castilian fleet; Tenorio himself lost his life, and only 5 of his galleys managed to reach Cartagena.
Abu Hasan crossed the Gibraltar straits on 14 August 1340, and all through the summer troops and supplies were ferried across to the Peninsula. On 22 September the siege of Tarifa was formally established, with the help of Yusuf I. However the Sultan made a serious mistake: believing it would take many months for the Castilians to rebuild a fleet, and in the hope of cutting down the enormous cost of maintaining his own fleet, Abu Hasan prematurely laid up most of his galleys and returned those of his allies, leaving only 12 at Algeciras.
Meanwhile, Alfonso XI had sought the aid of the King of Aragón and of his father-in-law, King Afonso IV of Portugal. The latter sent a Portuguese naval fleet led by Manuel Pessanha, Admiral of Portugal, and additionally paid for the services of 15 Genoese galleys led by commander Micer Gil Bocanegra. With the addition of 27 ships hastily completed at Seville, the Christian fleets appeared in force in the Straits in October, cutting off the supply routes between Morocco and the Peninsula.
Abu Hasan's position was now a difficult one, not only because the troops besieging Tarifa depended on supplies from Morocco, but also the Kingdom of Granada needed them, their forces having launched a series of limited attacks all along the frontier to hold the Castilians at bay. On 10 October, a severe storm wrecked 12 Castilian galleys, and the same day the Sultan launched an all-out assault against Tarifa, which was barely repulsed with heavy losses on both sides.
Alfonso XI left Seville on 15 October 1340 with a relief army, joining the King of Portugal the next day. They advanced to the line of the Guadalete river and there awaited further Castilian and Portuguese contingents. At last on 26 October the combined army, now 20,000-strong, crossed into enemy territory. When informed of their advance, Abu Hasan ordered the siege raised and his army took position on a hill between Tarifa and the sea. Yusuf I placed his army on an adjacent hill. On the 29th the Christian army reached the Deer Hill (Hayar al-Ayyal), 8 kilometres (5.0 mi) from Tarifa and barely 250 metres from the beach. Between them and their adversaries was a 4500m long valley crossed by the streams of La Jara and El Salado.
During the night, Alfonso XI had sent 1,000 horse and 4,000 foot troops to reinforce the Tarifa garrison, hoping to surprise the enemy rearguard during the battle; they had met only slight resistance by the light cavalry covering the Salado and reached Tarifa without difficulty. However, the officer commanding the light cavalry informed Abu Hasan that not a single Christian had managed to enter Tarifa during the night; whether he made his report in good faith, or in fear of admitting failure will never be known, but this omission had serious consequences next day.
The battle
The council of war decided that the Castilian King would attack the Sultan's main army, while the Portuguese host, reinforced by 3,000 Castilians, would engage Yusuf I. At nine o'clock on the morning of 30 October 1340 they moved out of camp, leaving 2,000 raw militia to guard it. The strong Castilian vanguard was led by the Lara brothers, while the King himself rode in the main body. On the left were the missile troops from the Kingdom of León, led by Pedro Nuñez, and on the right Alvar Pérez de Guzmán with a cavalry corps. Reinforcing the Portuguese forces were the Military Orders of Alcántara and Calatrava.
Abu Hasan had left the Jara crossing uncontested, but he deployed strong forces along the Salado. The Castilian vanguard met serious resistance; de Lara was unable to cross the shallow river, but the King's natural sons Fernando and Fadrique led an 800-man detachment towards the right and captured a small bridge, repulsing the cavalry defending it. Alfonso reinforced them with his whole right wing and the Salado was successfully crossed.