ADELAIDE, Australia (AP) — South African Daryl Impey sealed victory in the Tour Down Under cycle race Sunday as Germany's Andre Greipel won the sixth and final stage to claim his 18th stage victory in the World Tour opener.

Impey entered the final 90 kilometers (56 miles) stage, comprised of 20 laps of a street circuit in downtown Adelaide, wearing the tour leader's ocher jersey, but on the same time as Australian Richie Porte, who was bidding to become the first rider to win the event in consecutive years.

Porte knew his chances of winning were likely over when he was unable to establish a clear advantage in winning Saturday's fifth stage. He crossed the line eight seconds ahead of Impey, which meant the pair were credited with the same time overall, but the South African was placed ahead on a count back.

There were 16 seconds of time bonuses available Sunday — three seconds from each of two intermediate sprints and 10 seconds to the stage-winner. But Impey needed only to stay in touch with any breaks throughout the 20 laps to become the first South African to win the event.

"Coming into the race I didn't expect to win the race but you always hope everything goes well and according to plan," Impey said. "I worked really hard in the off season. The wins goes to my family in South Africa who sacrificed a lot to get me up today.

"The finish was pretty hectic. There's a lot at stake with just a few positions but I've been in this position before with (Australian Simon Gerrans) trying to defend the jersey so I was prepared for that. It's more hair-raising when you've got the jersey yourself."

Nicholas Dlamini, 22, made it a double celebration for South African cycling when he clinched the King of the Mountains title after a courageous ride in extreme heat throughout the tour. Dlamini, on his World Tour debut, took part in all the major breaks in the early stages of the tour during which temperatures sometimes reached 45 degrees Celsius (113 Fahrenheit).

Greipel, who was competing in the Australian tour for the first time in four years, won the first and last stages of the race but dropped out of contention for overall honors after previously winning around the Adelaide hills in 2008 and 2010.

Australian Caleb Ewan took over the overall lead when he won the difficult second stage, with its uphill finish designed to test the sprinters, and held his advantage after finishing third behind Italy's Elia Viviani on the third stage.

Triple world champion Peter Sagan took over in front when he won the fourth stage but led by only two seconds from Impey, Ewan's teammate on the Mitchelton-SCOTT team, who came to the fore as the tour progressed.

Porte staked his claim for victory on the fifth stage but couldn't shake Impey on the climb to the summit of Willunga Hill and entered the final stage with little realistic chance of back-to-back wins.

Breaks in the final stage by Logan Owen and Ben O'Connor gobbled up the time bonuses that Porte desperately needed and left the finish to the sprinters.

Ewan briefly looked in with a chance of another stage win but Greipel came off his wheel to cross the finish line in first place. Ewan was second, Sagan was third and Peter Bauhaus of Germany fourth.

Impey and Porte were credited with the same time on the final general classification with Tom-Jelte Slagter third overall, 16 seconds behind.