It is the second Royal appointment of 1998 for Newmarket-based Stoute, who was knighted in The Queen's Birthday Honours List.
Hannon, whose stables are near Marlborough, has trained for The Queen's racing manager, Lord Carnarvon, for many years, but has made it to the top of his profession largely without backing from the biggest owners such as the Maktoums.
The Queen had around 20 horses in training with Lord Huntingdon, who cited economic problems as the reason for handing in his licence. She also has horses with Ian Balding and Roger Charlton.
Stoute's Freemason Lodge stable was the base of a former royal trainer, Sir Cecil Boyd-Rochfort. "I am pleased that The Queen is renewing the association with Freemason Lodge and hope that we can emulate the success that Sir Cecil Boyd-Rochfort had for her."
Among the winners Boyd-Rochfort trained for The Queen were Pall Mall in the 2,000 Guineas of 1958, Aureole in the 1954 King George VI And Queen Elizabeth Stakes and Canisbay in the 1965 Eclipse Stakes.
An equally-pleased Hannon said: "It was a surprise. I have had some success for his Lordship but we haven't had a great year. It would be great if I could come up with The Queen's first Derby winner."
Stoute, 52, has been champion trainer five times, and has won every British Classic bar the St Leger, collecting the Derby with Shergar and Shahrastani. Hannon, 53, has won the trainers' championship twice.Reuse content