Spain are through to the semi-finals of the FIFA Confederations Cup South Africa 2009 but they were made to work for their place, and a 1-0 victory, by a resolute Iraq side.
The Asian champions made life difficult for their European counterparts from the offset and nearly snatched a shock ninth-minute opener when Alaa Abdul Zahra snatched on a Gerard Pique mistake to test Iker Casillas from 20 yards. Spain quickly established a stranglehold on possession, however, and Mohammed Kassid had to rush from his line to deny Fernando Torres after the Liverpool striker worked a delightful one-two with Xavi.
David Villa, meanwhile, was chasing the goal that would take him past Fernando Hierro as Spain's second-top all-time scorer, and he came close on 24 minutes with a left-foot volley that flashed into the side-netting.
Chances remained at a premium though, with Iraq generally successful in subduing their illustrious opponents, and Villa must have wondered if this was not to be his day when he spurned a glorious chance seven minutes into the second half. Santi Cazorla curled in a tantalising cross but, though unmarked ten yards from goal, the Valencia striker headed straight at the grateful Kassid.
Yet, like any great striker, Villa picked himself up and made amends with a superbly-taken winner, directing a precise header just inside the far post following another terrific cross from marauding left-back Joan Capdevila.
Spain continued to dominate and Xabi Alonso forced a fine save out of Kassid, but as the clock ticked down Nashat Akram almost snatched a dramatic equaliser, firing just wide from 25 yards with Casillas rooted to the spot. La Roja held on for a deserved victory, however, and in doing so equalled the longest winning streak in international football: 14 matches.