Spain are building towards the World Cup next summer, when they will try to defend the trophy they won in South Africa, and head coach Vicente del Bosque this week signed a new deal to remain as head coach until 2016.
Del Bosque has an opportunity to assess his players over the next few months and there were starts for Premier League players such as Jesus Navas, Alvaro Negredo and Juan Mata in Malabo.
It was Arsenal playmaker Cazorla who opened the scoring after just 14 minutes, when he pounced on a mistake by Equatorial Guinea's goalkeeper Danilo to tuck the ball home.
Jimmy Bermudez grabbed a famous goal for the hosts when he powered a header past Pepe Reina to equalise in the 36th minute.
Juanfran restored Spain's advantage three minutes before the interval following good work by Cazorla, and Del Bosque's men held on to beat a team ranked 119th in FIFA's world rankings.
The game will be remembered more for the aggressive challenges from the hosts than for the quality of football on show.
Inigo Martinez, Alberto Moreno, Fernando Llorente and Xabi Alonso were all on the wrong end of tackles that were not fit for a friendly, and the Real Madrid midfielder had to be substituted before the end of the first half after being hit by a two-footed lunge from striker Thierry Fidjeu.
The action subsided after the break, save for Diosdado's cynical foul on Llorente and the introduction of World Cup winners Andres Iniesta, David Villa and Pedro.
Llorente missed two good chances to extend the visitors' lead and also had a goal wrongly ruled out for offside, but Spain still got a fright in injury time.
As a final attack from the hosts fizzled out, the ball bounced off Marc Bartra and towards goal, but Reina grabbed it with both hands.