The 95-year-old monarch returned from the private hospital in central London at lunchtime on Thursday and is “in good spirits”, the palace added.
The Queen had cancelled a visit to Northern Ireland on Wednesday.
She was given medical advice to rest for a few days after a busy schedule of public engagements.
Prime Minister Boris Johnson said “everybody sends Her Majesty our very very best wishes”.
He added he was “given to understand that actually Her Majesty is characteristically back at her desk at Windsor as we speak”.
It is the first time the Queen has stayed in hospital since 2013, when she suffered symptoms of gastroenteritis.
The King Edward VII’s is a private hospital used by senior royals – including the Queen’s husband, the late Duke of Edinburgh, who received treatment there earlier this year.
The news on Wednesday that the Queen would have to cancel a trip to Northern Ireland was always going to cause concern.
Despite looking very well and happy at the numerous events she has attended over the past week, it cannot be forgotten that she is 95 years old.
It is a tricky balance for the palace to release enough details about the Queen’s health to keep the public informed while maintaining the privacy to which she is entitled.
It was for this reason that the news that she had been taken to hospital for tests was not announced, until a report on the Sun newspaper’s front page forced the palace’s hand.
People will be concerned, but the reassuring guidance remains that she is in “good spirits” on her return from hospital and is well enough to undertake some light duties.
It has been a busy period of official engagements for the Queen.
An official record of the Queen’s diary showed at least 16 formal events during October, and there had been the plans for her to embark on the two-day trip to Northern Ireland this week.
She was pictured hosting a Global Investment Summit at Windsor Castle on Tuesday evening alongside Mr Johnson.
However, on Wednesday a Buckingham Palace spokesman said the monarch had “reluctantly accepted medical advice to rest for the next few days”.
He said the Queen was “disappointed that she will no longer be able to visit Northern Ireland” – which would have involved an overnight stay.
The Queen’s October engagements
The Queen began the month in Scotland, planting a tree with the Prince of Wales at the Balmoral Estate on 1 October and attending the opening of the sixth session of the Scottish Parliament in Edinburgh the following day.
The following week, she met members of the Canadian military at Windsor Castle on 6 October and attended the launch of the Commonwealth Games baton relay at Buckingham Palace on 7 October.
Last week, on 12 October, she attended a church service to mark the centenary of The Royal British Legion at Westminster Abbey.
She then travelled to Wales to open the sixth term of the Senedd on Thursday.
By Saturday she was back in England – attending Champions Day at Ascot racecourse in Berkshire.
And on Tuesday evening she was back at Windsor Castle hosting the Global Investment Summit.
The Queen is expected to lead a royal delegation to the Glasgow COP26 climate change summit in two weeks’ time.
In reported remarks overheard at an event last week, she appeared to suggest she was irritated by people who “talk” but “don’t do” when it came to protecting the environment.
Earlier this week, the Queen declined a magazine’s award of Oldie of the Year, saying “you are only as old as you feel”.
She “politely but firmly” turned down the award, but sent the Oldie magazine a message with her “warmest best wishes”.