A 25-year-old man has been arrested in the Royal Mews area adjacent to Buckingham Palace.
Officers at the royal residence responded to a person climbing the wall and entering the Royal Mews at 1.25am on Saturday, the Metropolitan Police said.
He was searched before being detained outside the stables.
He did not enter the palace or its gardens at any time, the force added.
The man has been arrested on suspicion of trespassing on a protected site, which is an offence under the Serious Organised Crime and Police Act, and remains in custody at a London police station.