Rice played Brahms' Op. 34 with British Foreign Secretary David Miliband's wife, Louise, on violin, and three members of the London Symphony Orchestra.
The queen gave Rice an audio recording of the performance as a gift.
Rice is a classically trained pianist who had expressed a wish to play at the palace.
She was making her final trip to Britain before President-elect Barack Obama takes office next month. On Tuesday, she gave a farewell speech to NATO foreign ministers in Brussels.