Real Madrid confirmed a Champions League semi-final with Bayern Munich despite Apoel's defiant performance.
The hosts, with a 3-0 first-leg advantage, took the lead on the night through Cristiano Ronaldo's close-range finish before Kaka curled in a second.
Apoel's Gustavo Manduca finished a fine attacking move before Ronaldo scored a free-kick to make it 3-1.
Jose Callejon added a fourth on the break and, after Esteban Solari's penalty, Angel di Maria chipped in.
Real boss Jose Mourinho would have expected a more comfortable evening but will be satisfied to see his team in the last four for just the second time since 2003.
Real are six points clear at the top of La Liga with eight games to go and, as the Portuguese looks to win this competition with a third different club, could still meet domestic rivals and defending champions Barcelona in the final.
Before that, Real must see off Bayern, whom they meet in this competition for a 10th time.
Real's 54-year wait
They may have won this competition nine times but Real Madrid are hoping for a first Spanish league and European Cup double since 1958.
They beat the Germans in the semi-finals before their 2000 victory and in the quarter-finals on the way to their last Champions League success in 2002.
Whatever chance Apoel had of preventing that meeting had passed in the first leg and the visitors from Cyprus were content to defend deep from the start, damage limitation perhaps the summit of their aspirations.
Even so, Ronaldo tapped in from a Marcelo cross midway through the opening period to open a four-goal aggregate margin and Kaka, who also hit the post before half-time, bent a shot into the top corner from 25 yards to make it five.
The Brazilian's effort was his 27th in the Champions League, equalling Ryan Giggs' record for most goals in the competition by a midfielder.
Apoel pulled one back when an impressive attacking move ended with Ailton guiding a ball through for Manduca to clip a shot past Iker Casillas.
Ronaldo restored the two-goal margin on the night with a powerful free-kick from a wide position to take his tally to 49 for the season before Callejon latched on to a long ball to thump in a fourth.
After Hamit Altintop clipped Aldo Adorno in the area, Solari rolled in the penalty but Di Maria, who has been sidelined with a thigh problem, scored Real's fifth on the night and eighth in all with an impressive chip.
Real Madrid manager Jose Mourinho:
"Let me be honest, I don't think the final will be a Real Madrid v Chelsea final. It could be Bayern or Barcelona, I just don't think it will be Real Madrid v Chelsea and we know why.
"Somebody said that I have a signed contract with Man City and it's completely untrue so I'm not happy with news that has nothing of truth. I have two more years of contract in Madrid. Everyone knows I love England. I will be back one day but no-one knows when that one day will be.
"We know that it is almost impossible for Apoel to come here and beat us 4-1 and go through so it wasn't easy to motivate the boys but we did our job."