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.
Following a search, a man was 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.