McIlroy, who began the final round three shots behind Oosthuizen, fired a four-under-par 67 for a 20-under 264 that handed the 23-year-old Northern Irishman the second of the US Tour's four FedExCup playoff events.
Oosthuizen (71), who trailed McIlroy by three strokes with six holes to play at the TPC Boston, finished alone in second while former world number one Tiger Woods (66) was alone in third a further shot back.
The win was McIlroy's third of the season and first since last month's US PGA Championship at Kiawah Island. It put him level with Woods for the most victories on the US Tour this year.
"Today was great," McIlroy said. "I am delighted to get this win, delighted to go to No. 1 in the FedExCup, because it sets me up for a great next couple of weeks.
"Going out with a three-shot deficit. I just wanted to get off to a good solid start and maybe put Louis under a little bit of pressure."
The win guarantees that McIlroy will go into the season-ending Tour Championship in Atlanta knowing that a victory there would earn him the overall FedExCup title and the bonus of $10 million.
However, Monday's final round at the TPC Boston was by no means a cakewalk for McIlroy.
Oosthuizen, the 2010 Open champion, fought back after the turn and faced a 12-foot birdie putt on the last hole to force a playoff but his attempt slid past the right edge of the cup.
"You could hear all the commentators in the crowd saying what the putt is doing, so after putting that aside and just reading the putt properly, standing over it, I wanted to hit more than I read," the South African said.
"But even if I had putted where I read it, it doesn't do that much, which is amazing. If I go and hit that putt again, I'd probably miss it on exactly the same side."
Woods started the day six strokes off the lead but, despite carding a bogey-free round, he never really threatened the leaders.
The 14-times Major champion was four under on the front nine and then carded eight successive pars before signing off with a birdie at the last.
By clinching a third-place cheque for $544,000, Woods became the first player to surpass $100 million in career earnings on the US Tour.
South Korea's KJ Choi and Australians Jason Day and Aaron Baddeley were among several leading players who failed to finish in the top 70 in the FedExCup standings and will therefore not advance to next week's BMW Championship in Carmel, Indiana.