A Queens carjacking was foiled by an iPhone Saturday, police said.

Christopher Spence, 33, was arrested in Connecticut Saturday morning after he crashed a car he had stolen from an Uber driver in Queens, according to sources.

The Uber driver was sleeping in his car at Hoyt Avenue South and 21st Street in Astoria at about 2 a.m. on Saturday when a man in a ski mask opened the door to his car and dragged him out, police said.

The carjacker jumped into the driver’s seat and headed north on 21st Street, unaware that his victim’s iPhone was still in the car, police said.

The driver called 911 and police were able to trace the stolen vehicle to the New England Freeway using the Find My iPhone app, sources said.

Spence tried to get away from Connecticut State Troopers after they spotted the car, but he crashed and was arrested, police said. Spence was carrying a gun when he was arrested, sources said.