(Reuters) - Ignacio Martin scored a last-gasp try to fire Spain to a stunning 22-19 upset of top seeds Samoa in Monaco and secure the 12th and final qualifying spot for the men's rugby sevens tournament at the Rio Olympics.

Spanish players wept in joy after pulling off the shock at the Olympic repechage tournament on Sunday and the unheralded Europeans will now compete with global powers Fiji and New Zealand when the format makes its Games debut.

"I am still trying to take it in," Spain player Angel Lopez said. "This is a dream for us. We are going to be Olympians. We believed that we are good enough, but wow, this is pretty special."

Samoa had upset world series champions Fiji at the Paris Sevens last month and were heavy favourites to take the final berth with the shock loss to Spain leaving their coach Damian McGrath inconsolable.

"I am at a loss for words right now as all our hard work is snatched away at the death," the English former rugby league professional tweeted.

"Thanks to so many people for your unwavering support."

(Reporting by Ian Ransom; Editing by John O'Brien)