'Amazing Race' Season 21 Winner Revealed

The final teams headed to New York in Sunday night's episode, which saw one pair win the $1 million prize.

[Warning: Spoilers ahead if you haven't seen Sunday's episode.]

The Amazing Race season 21 has crowned a winner.

Josh Kilmer-Purcell and Brent Ridge, goat farmers and life partners from Sharon Springs, N.Y., won the $1 million prize in CBS' reality competition.

THR's Reality TV Poll: The 6 Biggest Surprises

The duo were considered underdogs for most of the race, having never won a challenge and even coming in last in a non-elimination leg. But they prevailed in Sunday's two-hour finale part thanks in part to their performance in a memory challenge at the end of the race.

Josh and Brent beat out the teams of Lexi Beerman and Trey Wier, a couple from Texas, and James Davis and Jaymes Vaughan, Chippendale dancers and best friends from Las Vegas, to take home the prize.

Sunday's episode saw the final three teams head to New York, where the clues took them to Coney Island, the Brooklyn Navy Yard, Little Italy and the United Nations.

STORY: 'Amazing Race' Creator Feared Cancellation Until Their First Win

This season featured a twist wherein the team that won the first leg of the season would win a $2 million prize if they won the final leg of the race. But that team, the "dating divorcees" Abbie Ginsberg and Ryan Ganz, was previously eliminated.

Josh and Brent -- nicknamed the "Beekmans" -- also are the stars of the cable reality show The Fabulous Beekman Boys.