The government has confirmed that a new defence training academy will be based at St Athan, creating 5,000 jobs, worth £58m annually to the local economy.
The investment, estimated at £16bn, is the single largest seen in Wales, and follows setbacks in securing the site as a centre of aviation excellence.
The academy will teach skills from aeronautical engineering to security to some 10,000 armed forces personnel.
But there was dismay for rival bids - RAF Cosford and Blandford in Dorset
Defence Secretary Des Browne told the Commons the centre would "transform the way" the UK's military is trained.
He said the Metrix Consortium won contracts to provide services at St Athan near Cardiff and HMS Sultan, Gosport.
The first of two packages under the deal will see training for 6,500 personnel transferred to the two sites over five years from 2008.
The second, also won by Metrix, will involve training for 4,500 currently spread across 18 sites in the UK.
Some 10,000 recruits from the Army, Navy and RAF will all be trained at the academy, which aims to be fully operational by 2013.
Its estimated value of around £16bn is equivalent to the Welsh assembly's entire annual budget.
For Welsh Secretary Peter Hain it was simply "fantastic news".
An artist's impression of how the military academy would look
He said: "These are very high class jobs, permanent jobs for generations to come with a state-of-the-art defence academy bringing all the three forces, RAF, Army and Navy, together and south Wales is the world class facility chosen."
It is hoped the economic benefits would reverberate across south Wales.
First Minister Rhodri Morgan said the bid had been a competition with "incredibly high stakes".
"Team Wales was up against the toughest possible competition in the bidding process - but we were able to show that we had the best location, the best facilities, the best workforce and the best environment."
Vale of Glamorgan MP John Smith had been "very confident" St Athan would win the bid.
"[The plans] are absolutely huge. It will be the biggest single investment ever in Wales of any kind. It will be by far bigger, for example, than the entire London Olympic bid."
Basic training will not be covered but what is known as Phase 2 and 3 training - teaching personnel their trades in areas ranging from aeronautical engineering and communications and information systems.
A new campus will be needed which is likely to employ 4,000 although not all will be new jobs as some will be relocated from existing training establishments around the UK.
However, it is thought it the base will create 1,500 jobs in the wider economy as well 1,500 construction jobs in order to build it.
The academy signals a change of fortune for RAF St Athan
RAF St Athan officially opened in 1938 and in the post-war years grew into one of the UK's largest RAF bases.
But its fortunes recently took a nosedive with a series of job cuts and false dawns.
In February, the Defence Aviation Repair Agency (Dara) confirmed it would go ahead with a £77m high-tech aircraft repair and maintenance centre - securing 2,100 jobs.
Called Project Red Dragon, it aimed to develop a world-class aviation centre, but despite the opening in 2005 of a super-hangar, much of the work went elsewhere.
In 2004, the announcement came that 550 jobs were being lost at RAF St Athan and just six months later a warning was issued that it could close altogether.
A further blow was dealt in November 2005 when more jobs cuts were announced.