Cowdenbeath comfortably moved into the Championship play-off final after getting off to the best possible start at Central Park.
Greg Stewart, who had put them ahead with a double in the first leg at Somerset Park, was on the mark once again on the half-hour, but it was Kane Hemmings who made an immediate impact for the home side.
Ayr had clearly not heeded the warning from the first leg and Hemmings opened the scoring just 20 seconds after kick-off.
He took a pass from Jon Robertson and curled a low shot into the corner of the goal from the edge of the penalty area.
Stewart grabbed the second goal after taking a pass from Hemmings and waltzing through the Ayr defence before producing an emphatic finish.
David Hutton did well to keep out another Hemmings shot after the Ayr defence opened up rather too easily once again.
But Ayr pulled a goal back out of the blue just when their support were starting to get on their backs - Michael Donald nudging the ball in from just a couple of yards out.
Donald almost equalised just before half-time with a stunning volley which was just inches wide.
Stewart had a chance for a second goal just after the break but Hutton stood tall and saved well.
Ayr's hopes of turning the tide effectively ended when Tom O'Brien went clear and casually rounded the goalkeeper before shooting into the vacant net.
The lively Stewart had another opportunity for a second goal but did not manage to get any power into his shot and Hutton easily gathered.
O'Brien then tried his luck from distance which had Hutton scrambling, but the goalkeeper managed to get a hand to it to touch it over his crossbar.
Stewart was again frustrated in his attempt to score a second goal when he shot wide from good position, but by then Cowdenbeath had done enough.