Arsenal's Santi Cazorla scored in the 13th minute, but Jimmy Bermudez leveled matters in the 36th minute for the hosts. Six minutes later, Atletico Madrid defender Juanfran Torres put La Roja ahead for good.
Spain suffered a setback when Xabi Alonso, playing for the national side for the first time since March after suffering a series of injuries, limped off the pitch just before the interval.
With twelve players in their squad born in Spain and with a Spanish coach in Andoni Goikoetxea, Equatorial Guinea gave a good account of themselves. Spain will now face South Africa in Johannesburg on Tuesday at Soccer City Stadium where they were crowned world champions in 2010.