Rubel finished with 6-26, helping the hosts to dismiss New Zealand for 162 runs after the visitors were set a revised target of 206 runs in 33 overs in the rain-hit match at the Sher-e-Bangla National Stadium in Dhaka.
New Zealand were 82-3 in 20 overs, replying to Bangladesh's 265 all out, when rain halted the game for nearly two hours. Needing 124 off 78 balls on resumption, Corey Anderson hit some lusty blows before Rubel turned the table with his hat-trick.
Rubel bowled Anderson, who scored 46 off 31 balls including three fours and fours sixes, before taking the wicket of Brendan McCullum and James Neesham to complete the hat-trick in his third over.
New Zealand skipper McCullum was caught by substitute fielder Shamsur Rahman while Neesham flicked a catch to wicketkeeper Mushfiqur Rahim on the leg side as Rubel became the third Bangladeshi to claim a hat-trick in a one-day international (ODI).
Rubel took the wicket of Ross Taylor before rain later added Nathan McCullum and Grant Elliot (71) to his tally, equalling the record of Mashrafe Mortaza for the best ever ODI bowling for Bangladesh.
Mashrafe, who claimed 6-26 against Kenya at Nairobi in 2006, took the catch of Elliot, the last man out for New Zealand. The visitors conceded a defeat as Kane Williamson was unable to bat for a thumb injury.
Earlier, Mushfiqur and Naeem Islam hit half-centuries to set up Bangladesh's total after New Zealand captain McCullum won the toss and elected to field.
The pair added 154 for the fourth wicket to rescue the home side from a perilous 25-3. Skipper Mushfiqur hit a solid 90 off 98 balls with eight fours and two sixes before he fell to Neesham.
Naeem struggled initially, taking 17 balls to get off the mark, but soon grew in confidence to hit a career-best 84 off 113 balls. Naeem, who was picked in the starting line-up after Bangladesh were forced to leave out ailing all-rounder Shakib Al Hasan, smashed 12 fours in his fourth one-day half-century.
"I thought the wicket was tricky and it wasn't coming on to the bat," Bangladesh captain Mushfiqur said after the match. "All credit to Naeem who came in and performed straightaway. Rubel was amazing."
New Zealand captain McCullum praised Mushfiqur and Naeem for the partnership. "We were in for a good game of cricket. Bangladesh recovered well after being three down through a good partnership," he said.
"We allowed them, Rahim and Naeem, to get away and get that partnership going. Our middle order didn't contribute today," said McCullum, who, also praised Rubel.
"Getting a hat-trick is an achievement. Rubel was outstanding." Tim Southee ended Naeem's innings when he forced an edge to the wicket-keeper.
Neesham and Southee were the pick of New Zealand bowlers, sharing seven wickets between them as Bangladesh lost their last five wickets for 33 runs.
Neesham claimed a career-best 4-42, while Southee returned with 3-34.
Spotted: Virat Kohli, Anushka Sharma and other celebs at Mumbai airport
Photos: Salman Khan's 'special friend' Iulia Vantur at a song launch
Photos: Hrithik Roshan, Anushka Sharma, other celebs dazzle at event
In Pictures: Sex scandals involving Indian politicians
Photos: Abhishek Bachchan and Farah Khan at Boman Irani's birthday bash