In a specially equipped pen, sheep were shown pictures of people on two computer screens, on one side would be an unknown person and on the other would be one of four celebrities.
The animal would receive a reward of food for choosing the photograph of the celebrity by breaking an infrared beam near the screen displaying it. If they chose the wrong photograph, a buzzer would sound and they would receive no reward.
The sheep eventually managed to identify the familiar face eight times out of every 10.
The group of celebrities the sheep were trained to recognise included actors Emma Watson and Jake Gyllenhaal, BBC newsreader Fiona Bruce and Obama.
"We've shown that sheep have advanced face-recognition abilities, comparable with those of humans and monkeys," Professor Jenny Morton, who led the study, said in a statement.
In addition to being shown images of the celebrities facing forward, scientists also tested the animals' ability to recognise the faces in photographs taken from other angles.
The animals' success rate fell by around 15 percent when presented with the faces at a new angle, an amount researchers said was comparable to that seen when humans perform the task.
Scientists aim to use the sheep as models to understand disorders of the brain, such as Huntington's disease, that develop over a long time and affect cognitive abilities.