Gabon beat Senegal in the opening semi-final on 6 December to become the first African team to qualify.
Morocco became the second team to qualify after defeating Egypt in a semi-final on 7 December.
Egypt became the third team to qualify, following a 2-0 win over Senegal in the third-placed play-off.
Senegal won a play-off 2-0 against Oman at the City of Coventry Stadium on Monday 23 April 2012 to take the final qualifying place.
By virtue of reaching the final of the 2011 UEFA European Under-21 Championship, Spain and Switzerland have qualified for London 2012. The third and final European place went to Belarus who defeated fellow defeated semi-finalists Czech Republic 1-0 in a play-off in Aalborg.