By Drazen Jorgic

RIO DE JANEIRO (Reuters) - Vivian Cheruiyot, Kenya's most decorated athlete, finally got her hands on an Olympic gold medal after winning the women's 5,000 meters on Friday by upsetting favorite Almaz Ayana of Ethiopia in the final.

Cheruiyot, 32, had been the nearly woman in her last three Olympic finals, winning two silver medals and one bronze, but she ran a superb tactical race to outwit 5,000m world champion Ayana in a Games best time of 14.26:17.

"It was my fourth Olympic Games and I had not had gold," Cheruiyot told reporters.

"I'm so happy for me, my husband, my son, my parents. This might be the last Olympics for me so I thought maybe God might give me gold."

Ahead of the race, all eyes were on Ayana, who last week shaved 14 seconds off the 10,000m world record in one of the greatest ever long-distance races.

The Ethiopian looked to be on the way to another dominant victory after surging into a huge lead four laps into the race but she tired in the closing stages and was unable to hold off Cheruiyot's late burst.

Cheruiyot, a four-times world champion over 5,000m and 10,000m, had to settle for silver over the longer distance but afterwards said she would be Olympic champion one day.

She stayed true to her word in the 5,000m and did not panic when Ayana burst into the lead, winning Kenya's first ever women's medal over the distance and cementing her legacy as a Kenyan long-distance great.

Her compatriot Hellen Onsando Obiri clocked a personal best of 14:29.77 to take silver.

"Ethiopia were very strong. We decided to go for teamwork," Obiri said. ""We already knew that Kenya was going to win the gold. It was just who would it be."

Ayana had to settle for bronze.

(Editing by Ed Osmond)