It will be one of eleven international soccer games played at the Millennium Stadium during the Olympics made up of five women's games and six men's matches.
The first game will be one of the five women's internationals to take place at the Millennium Stadium during July and August 2012.
The games in Cardiff will include two quarter final matches and the bronze medal men's match on August 10.
It is the latest coup for the Millennium Stadium which has already staged the Rugby World Cup, the FA Cup, the Heineken Cup Final, world title boxing, rugby league, showjumping, motorsport and major rock concerts.
The London Olympic soccer match deal was brokered by the WRU and will again put Wales on the global television output map as millions are expected to watch the action from Cardiff.
Group Chief Executive of the WRU, Roger Lewis, said: "We are proud to have played our part in bringing the London Olympics to Wales at the Millennium Stadium in 2012.
"This is a great honour for the WRU and for Wales which celebrates our stadium as a fitting venue for major sporting events of international magnitude.
"The stadium is the home of Welsh rugby but we are delighted that it is again able to prove its versatility by hosting international Olympic soccer."
The Millennium Stadium Manager, Gerry Toms, added: "We are used to hosting these big events but this is another dimension again for us.
"We are working with the London Olympics committee and we are looking forward to the challenge of delivering these events."
There will be two women's matches at the Stadium on July 25 followed by another on July 26 before the opening ceremony of the games takes place in London on July 27, 2012.
Two more games will be played on July 28 with a further match on July 31 and two more on August the first.
Quarter final matches will be played at the Millennium Stadium on August 3 and August 4 with the bronze medal play-off on August 10.
Although other international football matches will kick off on July 25 the first kick off will take place in Cardiff giving Wales and the Millennium Stadium the honour of hosting the start of the first London Olympics event.