Two hikers and their incapacitated dog who became stranded along a wooded trail in New Mexico were rescued with the help of a life-saving eye in the sky -- a firefighter's personal drone.

The hikers, an unidentified man and woman, and the dog were lost in Otero Canyon Saturday afternoon, according to the Bernalillo County Fire Department. One of them called 911 about 5 p.m., and a rescue team was dispatched to search for them.

Bernalillo County Fire Department

Firefighters use drone to rescue stranded hikers and an injured dog, May 12, 2018 at the Otero Canyon in New Mexico.

The search team -- five members on the ground, three back at command -- found the hikers and the dog after about an hour, said Lt. David Lujan, a spokesman for the Bernalillo County Fire Department.

But the team became disoriented themselves, Lujan told ABC News. And time was key -- the crew had about two hours of daylight left before darkness would set in, he added.

"They were having a difficult time finding their way back," Lujan said. "The hikers were off the beaten path."

That's when they deployed the personal drone of a firefighter on the team, Lujan said. Coincidentally, the firefighter had been testing it for a commander before the search crew headed out, he said.

The firefighter had the presence of mind to take it along when they were deployed to search for the hikers, Lujan said.

"That was forward thinking by our guys," Lujan said.

Back on the trail, the drone hovered and, with the help of the crew back at command, pointed the search crew and the hikers in the right direction, he said.

But another challenge for the team was the dog -- which was 14 years old and weighed about 60 pounds, Lujan said. The dog appeared exhausted and dehydrated, and had become completely immobile, he added.

Bernalillo County Fire Department

Firefighters use drone to rescue stranded hikers and an injured dog, May 12, 2018 at the Otero Canyon in New Mexico.

"He wasn't walking," Lujan said. "The dog was just laying there."

The crew gave the dog some water and then took turns carrying it for about a mile and a half back to command, Lujan said.

Neither the hikers nor any members of the rescue team were injured, Lujan said.

The team was "ecstatic" about the rescue -- and the success of the drone, Lujan said.

"They were really excited they accomplished the task," he said.

Lujan added that the department had been planning to purchase two drones even before the rescue.