Although England eventually won the second Investec Test at Lord's by an emphatic 347 runs, they found themselves in serious trouble at the start of both of their innings after losing three quick wickets on each occasion.
However, centuries first by Ian Bell and then by Joe Root, combined with useful contributions from down the order, saw England recover and ultimately bat Australia out of the game.
Cook told Sky Sports after seeing England snatch victory in the final over of the fourth day: "It was obviously a bit of hard work and we just about got there in the end.
"We've played some pretty good cricket over these two weeks. We've also had to scrap very hard in this game being 30 for three in both innings - people have had to stand up with the bat and deliver.
"Belly's hundred in the first innings and Rooty's hundred in the second innings when they were under pressure at the start was fantastic. And obviously the bowlers have done a great job in both of these matches."
Cook was also full of praise for Root's "fantastic" century, while insisting there is still plenty more to come from the young opener.
Root was named man of the match after scoring 180 in England's 349 for seven before taking the valuable wickets of Michael Clarke (51) and Usman Khawaja (54) as Australia were bowled out for 235 in their second innings.
Cook said of the 22-year-old, who was promoted to opener in place of Nick Compton ahead of the Ashes: "It was a great knock.
"He was under pressure in that second innings. Obviously he's had a bit of success at number five and it's slightly different at the top of the order, but we all know what a great player he is.
"He's still got a huge amount of work to do but he's the right character at the top of the order and it was a fantastic knock."
England lost Kevin Pietersen to a calf strain following day three but Cook hopes the batsman will be fit for the third Test at Old Trafford, which starts on August 1.
"It's just a strain. Thankfully it's not a tear," the skipper said. "We'll do what we always do - try and work hard on him and hopefully he'll be fit for OT."
Despite going 2-0 down in the five-match series, Australia captain Michael Clarke refused to give up hope that his side could yet win back the Ashes.
"It was certainly not the performance we were after but we've got some time now to make amends I guess," he said following the loss.
"We'll continue to work hard in the nets and try and get right for Manchester. We know we've got to win the next three Tests to win this series so it's very clear for us now."
Asked if he thought that was a realistic target, Clarke added: "Of course it is. I think it's going to be hard, there's no doubt about it, but I'd be silly to go into Manchester expecting to lose.
"We'll do everything in our power to try and improve our game, because we need to do that, especially our batting. But take nothing away from England. I thought they outperformed us again in this Test."
- Sports & Recreation
- Joe Root