Oman beat defending champions Iran 4-3 in a high-quality clash to secure first place in Group D and condemn their opponents to the runners-up spot at the Asian Football Confederation Beach Soccer Championships in Pattaya in Thailand.
The result at the Main Arena means Oman will face Group C runners-up Bahrain in the quarter-finals, while Iran are set for a meeting with Group C winners Japan.
The tie had been locked at 2-2 deep into the final period, but Sami Al Bulushi and Yahya Al Arami scored crucial late goals to give Oman what proved to be an insurmountable lead.
Mohammad Masoumizadeh had put Iran ahead in the fourth minute before Mushel Al Araimi levelled the tie with an absolutely sensational volley from deep within his own half.
Jalal Al Sinani then gave Oman the advantage just before the end of the opening period, only for Iran to hit back in the third through Masoumizadeh, who atoned for an earlier squandered penalty with an overhead volley that bounced wickedly off the sand and into the net.
Goals from Al Bulushi and Al Arami ultimately settled the game, however, with Mohammad Ahmadzadeh scoring a consolation with 30 seconds remaining.
"First of all, I thank God that we finished the game with a win, which was our target," Oman head coach Talib Hilal said.
"I'm very, very happy with my boys, because they played with one of the best teams in the world.
"It was a tactical game, different from the first match, and we were well prepared."
In Group C, Japan sealed top spot after scoring several spectacular goals in a 6-2 win against Bahrain.
Ozu Moreira and Masanori Okuyama both bagged braces in a match between two previously unbeaten teams, with the former joining team-mate Shusei Yamauchi at the summit of the tournament scoring charts with six goals in three matches.
Bahrain had to settle for second place on six points.
They were followed by Kuwait who bid farewell to the event in grand style, overpowering Qatar to claim a thumping 8-1 win.
Following a rest day tomorrow, the four quarter-finals are due to take place on Thursday (March 14).
The other two last-eight ties see Palestine face Lebanon and the United Arab Emirates go up against Malaysia.
The semi-finals are scheduled for Friday (March 15), while the final and third-place match are set for Sunday (March 17).
The top three teams will qualify for the 2019 FIFA Beach Soccer World Cup in Paraguay.
That event is due to be held from November 21 to December 1.