Prime Minister David Cameron hailed the creation of the £3.1bn super-carrier HMS Queen Elizabeth as an "investment in the future of British security, British prosperity and our country's place in the world".
Labour leader Ed Miliband said it was a visible reminder of what can be achieved with cross-border collaboration.
Scottish Secretary Alistair Carmichael insisted it was a prime example of the UK at its best.
But First Minister Alex Salmond said it was a huge miscalculation to think events such as the naming of the super-carrier would boost the No vote in September, noting: "What keeps us safe for the future is not the will power of David Cameron, it's this magnificent deep water facility and the great skills of the workforce."
Angus Robertson, the SNP's defence spokesman, seized on reported remarks by Defence Secretary Philip Hammond that the second carrier, HMS Prince of Wales, would be built in Scotland, irrespective of the referendum outcome, and insisted: "Rosyth has a bright future in an independent Scotland."
During the event, it was reported by audience members that both the Prime Minister and the First Minister were booed, but one observer tweeted that the boos for Mr Salmond were "considerably louder".
Before the official ceremony began, the Red Arrows flew over the dockyard, painting the sky over the Forth red, white and blue.
The fly-past was followed by a procession of three generations of Royal Navy aircraft, including an historic 1950s de Havilland Sea Vixen fighter, the last and only flying aircraft of its kind in the world.
Her Majesty, accompanied by Prince Philip, the Lord High Admiral, described the naming ceremony as marking a "new phase in our naval history" and that the super-carrier "as flagship for the Royal Navy will be a source of inspiration and pride for us all".
She said: "Wherever this ship may serve, whatever tasks may be asked of her, let all those who serve on her know that on this day she was blessed with the prayers of us all for her success and for her safe return to calm waters.
"I name this ship Queen Elizabeth. May God bless her and all who sail in her."
Admiral George Zambellas, the First Sea Lord, said the ship was fit for a Queen and would serve as a national instrument of power and a national symbol of authority.
"That means she will be a national icon too, all the while keeping the great in Great Britain and the royal in Royal Navy," he added.
Among the 4000 or so people present were the great and the good of the political Establishment: not only Mr Cameron and Mr Salmond but several Coalition ministers, including Chancellor George Osborne and his deputy Danny Alexander, Mr Miliband and his Labour predecessor Gordon Brown as well as foreign dignitaries, including American naval officers.
The Union flag flew prominently from the 65,000 tonne ship's mast, while a Royal Marine Band played the British national anthem twice during the 90 minute-long ceremony.
The warship is the first new carrier in the British fleet for more than 20 years.
Its official naming comes five years after the first metal was cut and almost three years since the first section of the ship entered the dry dock at Rosyth for construction to begin.
Work on HMS Queen Elizabeth has taken place not just in Rosyth but also in Govan, Appledore, Birkenhead, Portsmouth and on the Tyne, creating and sustaining more than 10,000 jobs across the supply chain.
The defence sector employs more than 12,600 people in Scotland, according to government figures. The super-carrier and its sister vessel, HMS Prince of Wales, which is now under construction, will form the centre-piece of Britain's defence capability for the 21st century.
The estimated total cost of the vessels is £6.2bn - well over the initial projected cost of £3.7bn.
The Royal Navy will take charge of HMS Queen Elizabeth in 2017 for sea trials but the warship will not be fully operational until 2020.
A decision will be made during next's year defence review on whether the second super-carrier will become operational or sold.