Solari has led Real to four wins out of four since being installed on a caretaker basis following Lopetegui's abrupt sacking last month.
Mashrafe is widely expected to retire after the World Cup in 2019.
The first and last part of the course featured elements of motocross route, appreciated by 150 riders who started the race.
The four-year deal will see QNB support all World Athletic Series Events from 1 January 2019 to the end of 2022.
His dramatic success confirmed Mercedes’ record-equalling fifth consecutive double of drivers’ and teams’ championships.
The result means Federer is now in danger of failing to qualify for the semi-finals for just the second time in 16 appearances at the event.