The 95-year-old monarch returned from hospital at lunchtime on Thursday, the palace said.
The Queen was said to be "disappointed" after cancelling 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.
In a statement on Thursday night, Buckingham Palace said: "Following medical advice to rest for a few days, the Queen attended hospital on Wednesday afternoon for some preliminary investigations, returning to Windsor Castle at lunchtime today, and remains in good spirits."
The Queen was seen by specialists at the private King Edward VII's Hospital in central London, about 19 miles (32km) from Windsor. Her admittance is understood not to be related to coronavirus.
The overnight stay was said to be for practical reasons and the Queen was back at her desk undertaking light duties on Thursday afternoon.
She was pictured hosting a Global Investment Summit at Windsor Castle on Tuesday evening alongside Prime Minister Boris Johnson.
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.