MELBOURNE, Australia — Milos Raonic was either one or two points from dropping each of the sets he eventually grabbed on the way to edging 2014 champion Stan Wawrinka 6-7 (4), 7-6 (6), 7-6 (11), 7-6 (5) in the Australian Open’s second round.

The 16th-seeded Raonic, the Wimbledon runner-up in 2016, hit 39 aces in the 4-hour, 2-minute thriller.

He barely came through.

Wawrinka, owner of a total of three Grand Slam titles, was two points away from taking the second set, held three set points in the third, and was two points away from forcing a fifth while ahead 5-4 in what would turn out to be the last tiebreaker.