Derby left it late to secure a place in the Sky Bet Championship play-offs with a 3-1 win over West Brom at Pride Park.
Martyn Waghorn put the hosts – who knew that victory would guarantee a top-six finish – ahead in the 19th minute, only for Stefan Johansen to level shortly after half-time.
With Middlesbrough winning, it looked as though Frank Lampard's side had blown their chance of promotion.
But Mason Bennett and Harry Wilson struck within two minutes of each other to set-up a two-legged clash with Leeds.
The visitors were already assured of a play-off spot, and will face rivals Aston Villa for a place at Wembley. The Baggies will be without Hal Robson-Kanu after he was sent off in stoppage time.
Derby made a nervy start and might have fallen behind when Jay Rodriguez embarked on a mazy run after 10 minutes, only to send his shot high and wide from the edge of the area.
Moments later Rodriguez played in Jacob Murphy, who skewed his effort wide from 12 yards with only goalkeeper Kelle Roos to beat, while at the other end a Tom Lawrence drive from 25 yards had to be parried behind by Sam Johnstone.
Waghorn calmed the nerves of the home fans after 19 minutes when he headed Jayden Bogle's fine cross from the right into the bottom corner for his 13th goal of the season.
West Brom created plenty of chances to level, with a well-worked free-kick after half an hour seeing Murphy cut the ball back to Dwight Gayle, who inexplicably fired wide from eight yards.
Ahmed Hegazi then headed a Johansen corner over from six yards out, while Waghorn missed out on a chance to double his tally when he headed Scott Malone's cross straight at Johnstone.
Just two minutes after half-time the visitors did draw level. Rodriguez played the ball in from the left and Johansen powered a left-footed effort into the far corner from 12 yards.
Derby almost hit back instantly, with substitute David Nugent denied by Johnstone inside the six-yard box.
Mason Mount then saw a vicious 30-yard effort palmed away by Johnstone, Malone's drive from the corner of the box had to be clawed away and Duane Holmes fired wide as the hosts enjoyed their best spell of the game.
The Rams restored their advantage 20 minutes from time. Nugent's clever backheel played in Lawrence, and his effort deflected into the path of Bennett to apply the finish.
Wilson added a third from the penalty spot after 72 minutes when Kyle Bartley brought down Lawrence in the area.
Nugent was denied by Johnstone and Mount fired wide from the edge of the area as the home side threatened to run riot, before Robson-Kanu saw red for violent conduct after clashing with Bradley Johnson.