By Mark Trevelyan

RIO DE JANEIRO (Reuters) - Dutch gymnast Sanne Wevers changed her gameplan at the last minute on Monday after American Simone Biles lost her footing on the beam, and it paid off when she became the first woman from her country to win an individual gymnastics gold.

Biles had been favorite to win her fourth gold medal of the Rio Games but drew gasps as she lost her balance after a front somersault and had to grab the beam with both hands to stop herself falling.

In a sport where athletes are judged on the sum of two scores - a "D-score" for difficulty plus a mark for quality of execution - Wevers said she had originally planned to go all out with her hardest routine.

"That was actually the plan but after I saw her score I was like 'OK, maybe just be safe and be as high as possible on my D-score, but also really watch my execution'," she said.

Performing immediately after Biles, she adjusted her D-score to 6.6 from 7.0 and executed a graceful routine featuring numerous spins, including a triple.

Having qualified only fourth for the final, she finished with a score of 15.466, with Laurie Hernandez of the United States taking the silver with 15.333 and Biles the bronze on 14.733.

On her way to talk to reporters, Wevers was congratulated in person by King Willem-Alexander -- "He just said he was really proud of me" -- and fielded a phone call from Prime Minister Mark Rutte.

"To be out there and do my best routine ever in such a big final, it's amazing," she said.

(Editing by Alison Williams)