|Tonga (22) 35|
|Tries: Veainu 2, Ram 2, Fosita Cons: Lilo 2 Pens: Lilo, Morath|
|Namibia (7) 21|
|Tries: Tromp, Burger 2 Cons: Kotze 3|
Tonga scored five tries to beat Namibia in a thrilling match at Sandy Park.
Telusa Veainu and Jack Ram crossed for Tonga, but Namibia's Johan Tromp pulled a try back, before Latiume Fosita's try helped Tonga into a 22-7 lead.
Ram got his second score soon after the break to secure Tonga's bonus point, although Namibia captain Jacques Burger was then forced over to keep it close.
But Veainu's second try secured Tonga's first win of this World Cup, despite a late consolation score from Burger.
Following a shock 17-10 loss to Georgia in their opening game, the win lifts Tonga to second place in Pool C, although their meeting with Argentina on Sunday is a must-win if they are to have any hope of progressing to the quarter-finals.
A first ever World Cup win still eludes Namibia, but they scored three tries in a match at the tournament for the first time.
Tonga too strong in first half
In front of a capacity crowd at Exeter's Sandy Park, it was clear that neither side wanted a narrow, forward-orientated game, and the outcome was a thrilling clash.
Namibia's Danie van Wyk got the crowd going with a dangerous run before Tonga hit back a minute later with the first try.
Veainu broke from midfield and surged through the Namibian defence before going over despite some desperate last-ditch defending.
Flanker Ram showed a great turn of pace six minutes later as he skipped through the Namibian line to score after breaking down the blindside.
But the African underdogs ensured they would not go down without a fight as Tromp got his first try of the World Cup following an excellent run through Tonga's defence by second-row Tjiuee Uanivi.
A try from Fosita and a penalty from Lilo increased the lead before Veainu had a try chalked off by the TMO after he dived over in the corner, having just put a foot into touch.
Burger inspires Namibian fightback
Tonga might have had the game wrapped up at half-time, but inspirational Namibia skipper Burger ensured they would not go down without a fight.
After Ram had extended Tonga's lead soon after the break with his second try, the Saracens flanker was forced over the line by his Namibian pack to score the first of two tries.
Namibia changed their attacking impetus, trying to play the game more through the forwards, and to an extent it worked, but Tonga looked dangerous whenever they had ball in hand.
Veainu illustrated that danger as he got Tonga's final try with 26 minutes left, going over in the left corner.
But the inspirational Burger went over for his second try after another strong maul from the Africans. Kurt Morath added a late penalty for Tonga, becoming his country's all-time record points scorer in the process.
As Tonga face a potentially decisive clash with Argentina, Namibia will look to next Wednesday's clash with Georgia as their best chance to break their 17-game winless run at World Cups, stretching back to 1999.
As it stands
Tonga head coach Mana Otai said: "It was hugely important, just to get the victory, but also the five points - we wanted to win and get maximum points.
"There are two more games to go, we're getting the calculators out and working out points. We're second in our pool and we could easily go into Argentina with an advantage points-wise."
Tonga captain Siale Piutau, comparing the last World Cup to this World Cup, said: "We lost to Canada in the last one and it's the same feeling we had this week after losing to Georgia.
"We got the win but we know we're going to have to play a lot better against Argentina."
Namibia coach Phil Davies said: "I'm proud of the way we tried to play rugby. In parts of the first half we moved the ball well, but that last pass was poor at times.
"The players put a huge effort in against a pretty big and physical Tongan side, they were hard to stop when they were carrying the ball."
Namibia's Jacques Burger told BBC Sport: "I don't score many so when I did score it was a good feeling.
"They were forwards' tries, I was just at the back of it. It was great to get those tries, but I'd swap them any time to get a win."
Tonga: Vungakoto Lilo, David Halaifuna, Siale Piutau (co-captain), Sione Piukala, Telusa Veainu, Latiume Fosita, Sonatane Takulua; Viliami Ma'afu (co-captain), Jack Ram, Sione Kalamafoni, Joseph Tu'ineau, Hale T Pole, Sila Puafisi, Aleki Lutui, Soane Tonga'uiha.
Replacements: William Helu for Lilo (64), Kurt Morath for Piutau (60), Samisoni Fisilau for Takulua (58), Tevita Mailau for Tonga'uiha (63), Paula Ngauamo for Lutui (47), Halani Aulika for Puafisi (63), Tukulua Lokotui for T-Pole (44), Fonua for Kalamafoni (33).
Namibia: Janco Venter, Johan Tromp, Danie van Wyk, Johan Deysel, Russel van Wyk, Theuns Kotze, Eneill Buitendag; Renaldo Bothma, Rohan Kitshoff, Jacques Burger (captain), Tjiuee Uanivi, Janco Venter, Johannes Coetzee, Torsten van Jaarsveld, Casper Viviers.
Replacements: Damian Stevens for Tromp (67), Darryl de la Harpe for Deysel (72), David Philander for Buitendag (72), Johnny Redelinghuys for Viviers (41), Louis van der Westhuizen for van Jaarsveld (74), AJ de Klerk for Coetzee (72), PJ van Lill for Venter (42), Tinus du Plessis for Bothma (71).
For the latest rugby union news, follow @bbcrugbyunion on Twitter.