Both teams had chances during an open and entertaining affair, but Roofe's 55th-minute strike was the difference as Leeds secured an advantage ahead of the second leg at Elland Road on Wednesday night.
There was a hugely controversial moment in the latter stages, though, when Derby were awarded a penalty before the decision was overturned by referee Craig Pawson's assistant.
The first real chance of the match fell to Derby in the eighth minute, but David Nugent, who had been fed by Harry Wilson, saw his goal-bound strike blocked over by Gaetano Berardi - in for the injured Pontus Jansson.
Mateusz Klich had the away side's first strike in the 11th minute, but the midfielder's effort from distance was always moving wide of Kelle Roos's post, before Stuart Dallas curled one just over the crossbar moments later.
Leeds were the team on the front foot as the match approached its 20-minute mark, with an overhead kick from Roofe another attempt from the Whites during a strong spell of pressure.
Corners were a real area of concern for Derby as Leeds continued to look dangerous from set pieces.
The alteration did not change the pattern of the match, however, as the visitors continued to dominate the ball - passing through the lines into the dangerous Pablo Hernandez.
While Marcelo Bielsa's side were controlling the possession, Derby were being forced to play on the counter-attack through the likes of Duane Holmes and Wilson, but there was little space for the dangerous duo to operate.
Roofe's movement was also a feature of the first half as the number seven continued to work space in a forward position, and only smart defending from Fikayo Tomori prevented the forward from picking out Leeds teammate Klich with a cross in the 36th minute.
The final chance of the first period also fell to Bielsa's side, but Dallas struck wide of the post from a dangerous area after Luke Ayling had kept a swipe from Roofe in play.
Leeds made a bright start to the second period, and had a half-chance in the 47th minute when a deep cross from Klich found Jack Harrison, but the attacker saw his effort deflected behind for another corner.
Roofe continued to cause Derby skipper Richard Keogh problems with his bright movement, and it was Leeds's number seven who made the breakthrough in the 55th minute.
Roofe deserves huge credit for picking out the bottom corner with a cool finish, but the goal was all about the delivery from Harrison, whose sensational cross from the left was too much for the home side's defence.
The goalscorer almost doubled the advantage in the 57th minute after finding space outside the Derby box, but Roos was down to make a smart save during a tough period for the Rams.
Bielsa's side had another glorious chance just past the hour when Shackleton picked out Hernandez inside the penalty area, but the experienced attacker somehow missed the ball.
Jack Marriott and Mason Bennett both came off the Derby bench as Frank Lampard's side chased a leveller, and the former almost met a dangerous cross from Scott Malone 20 minutes from time but Leeds survived.
Derby were awarded a penalty in the 78th minute when Harrison brought Jayden Bogle to the deck inside the Leeds box, but after consulting his linesman, the referee decided to reverse the decision.
There was not an awful lot in what Pawson's assistant saw as a foul on Harrison before the contact on the Rams defender, but the visitors were given the benefit in what was a huge call.
Leeds, who could have lost Klich to a red card following what looked to be a headbutt on Tomori, might have added a second late on through Shackleton, but the 19-year-old saw his attempt saved by Roos as it finished 1-0 to the visitors ahead of the return clash next week.
DERBY (4-2-3-1): Roos; Malone, Keogh, Tomori, Bogle; Johnson, Mount; Lawrence (Huddlestone 86'), Holmes (Bennett 70'), Wilson; Nugent (Marriott 64')
LEEDS (4-5-1): Casilla; Ayling, Berardi, Cooper, Dallas; Hernandez, Forshaw (Shackleton 24'), Phillips, Klich, Harrison; Roofe (Clarke 81')