David Willis had been browsing in Waterstones in Trafalgar Square on Thursday night, but went downstairs shortly after 9pm to find the lights out and the shop deserted.
Despite calls to the shop’s security and police, he spent two hours trapped inside the darkened store - and was only rescued when he used Twitter to alert the world to his predicament.
Mr Willis, from Texas in the United States, told ITV’s Good Morning Britain: “I’m very tired, I did not sleep much last night but it feels good to be free.”
He said he had popped in to the bookshop just before 9pm, not realising it was about to close, and strolled past employees as he went upstairs to sit down and use the internet.
Around 15 minutes later he got up to leave, but when he walked downstairs he discovered it was “completely dark and the door is locked”.
He added: “Right when I came downstairs I saw I had been locked in and I went to the door, tried to open it, the alarm went off. The alarm sounded in Trafalgar Square for probably 20 or 25 minutes.
“The phone rang after about ten minutes or so. It was a security guard and I talked to him and I thought, you know, I’ll be out of here in a few minutes. And a little more and a little more time went by.
“I finally said I’m going to talk to the police, I talked to them, and I thought I would get out from the police very soon.
“Then I just kept waiting and waiting, so eventually I went to social media.”
He posted a picture of himself behind shutters inside the darkened store with the message: “This is me locked inside a Waterstones bookstore in London.
“I was upstairs for 15 minutes and came down to all the lights out and door locked. Been here over an hour now. Supposedly someone is on their way.”
In a later post which was retweeted by more than 7,000 people, he wrote: “Hi Waterstones, I’ve been locked inside of your Trafalgar Square bookstore for two hours now. Please let me out.”
When he was finally released, he wrote: “I’m free.”
A Scotland Yard spokesman said police were called at around 9.35pm “by a man claiming to be locked inside a shop”.
He added: “Officers attended and following the arrival of a key holder the man left the building shortly after 11pm.”
The Waterstones’ website says the Trafalgar Square store closes at 9pm.
The book retailer posted a message on its Twitter feed saying: “We’re pleased to announce that [Mr Willis] is a free man once more. Thanks for your concern and tweets.”
Waterstones has been quick to poke fun at the mishap - posting a blog on its website entitled What to read when you’ve two hours on your hands...and you are locked in a bookshop.
Last month homeless man Raj Patel, 32, was locked inside the Tate Britain art gallery in Pimlico, London, after falling asleep in the toilet.
He told the Evening Standard at the time that it was “eerie” inside the closed gallery. He spent around ten minutes wandering around the Tate before a security guard let him out.