On a spin-friendly surface, Australia posted 231 all out in 50 overs after half-centuries from Josh Inglis (51) and Cameron Green (53).
Matt Renshaw added a valuable 43, while Oliver Peake's quickfire 31 helped the visitors push their total past 230.
In reply, Pakistan struggled from the outset, losing both openers inside two overs. Ellis and spinner Matt Kuhnemann ripped through the top order, leaving the hosts reeling at 58 for 5.
Shadab Khan fought back with a resilient 71 off 104 balls and shared a 59-run partnership with Arafat Minhas, but wickets continued to fall at the other end.
Ellis returned to remove Minhas and later Haris Rauf to end Pakistan's hopes of a comeback.
Pakistan were eventually bowled out for 190 in 44 overs, with Shadab becoming the final wicket.
The series is now level at 1-1 heading into the deciding third ODI.