Aberdeen booked an 8,000-mile round-trip to face Kazakhstan's Kairat Almaty in the Europa League third qualifying round, but they had to work hard to do it despite a healthy lead from the first leg of their tie against HNK Rijeka.

All the goals in what turned out to be an entertaining 2-2 draw – giving Aberdeen a 5-2 aggregate win – came after the interval at Pittodrie, with Niall McGinn and Jonny Hayes netting the goals that saw the Dons through after the visitors had gone 2-0 up thanks to Marin Tomasov and Zoran Kvrzic.

With the Croats trailing 3-0 from the first leg, it could be expected that they would burst out of the traps but despite enjoying plenty of possession they rarely troubled the well-marshalled Aberdeen defence.

In fact, the best chance of the first half went Aberdeen's way when McGinn found space to flash a 20-yard strike towards the bottom-right corner of Simon Sluga's goal, but the goalkeeper was able to parry away.

The hosts could have gone in front shortly after the restart when a wicked inswinging corner from Hayes on the right found Ash Taylor on the six-yard line, but the defender had to adjust his body and could not direct his header on target.

Rijeka were far from out of things, and Roman Bezjak again found space in the area only to slice his shot well over the bar when a bit more composure was required.

The near-16,000 crowd inside Pittodrie were silenced when the visitors did get a goal, though. A well-worked passage on the right saw Tomasov work his way into the area, feinting to shoot before side-footing into the bottom-left corner from 16 yards.

Aberdeen should have been level just second later. Captain Ryan Jack won the ball in midfield and played in David Goodwillie down the right. His cross looked perfect for Hayes at the back post, but the winger could not direct his diving header on target.

Moments later, the visitors made it 2-0. There seemed little danger as substitute Kvrzic gathered the ball 30 yards from goal, but after a couple of strides forward, he unleashed a thunderbolt which took a deflection and looped past Ward and into the net.

But almost straight from the restart, Shay Logan's clipped pass down the wing fell to McGinn, who cut inside before steering a low shot in off the far post from the corner of the six-yard box.

And after 72 minutes, the three-goal aggregate lead was restored. Goodwillie benefited from Stefan Ristovski's misjudged leap to scamper away down the left before pulling back for Hayes to find the bottom-left corner of the net from eight yards.

Although the visitors enjoyed the bulk of the possession for the remainder of the game, their only real chance came in stoppage time when Tomasov curled a free-kick over the crossbar.