Ashley Grimes netted a brace as Rochdale twice came from behind to beat Chesterfield and reach the second round of the Carling Cup.
Danny Whitaker fired the Spireites ahead but Grimes levelled from Jean-Louis Akpa Akpro's cut back.
With the tie in extra time, Whitaker put Chesterfield back in front from the spot after Jack Lester was fouled.
But Dwayne Mattis turned a cross into his own net before Grimes lashed a Joe Widdowson cross into the top corner.
VIEWS FROM THE DRESSING ROOM
Rochdale manager Steve Eyre told BBC Radio Manchester:
"It was fantastic, but we didn't have it easy, but if you look at the balance of play I think we deserved the outcome.
"We've done everything to try and get a positive outcome and between us, I think we're well worth our place in the next round.
"The approach play by Ashley Grimes was Premier League class, but none of the chances fell for him, but the two that did he scored from."
Chesterfield manager John Sheridan told BBC Radio Sheffield:
"I thought we worked hard when the ball was in front of us and we kept our shape.
"I think we could have avoided their goals.
"I'm disappointed because once we got the second goal I thought we were just on top of the game then, I was hoping we could keep the lead a little bit longer."