Sasuke's a genuis, him being intelligent, and figuring things out isn't simply luck.
Sasuke was up against two opponents who were using powers he had never seen before, while fighting Deidara, he analyzed his moves, figured them out in battle while fighting, came up with multiple counter strategies, and successfully did them, despite also having to think about Tobi who was around was helping Deidara.
While Deidara attacked from the sky (longe range), Tobi was setting up his clay bombs underground, so Sasuke had to pay attention to not only Deidara attacking from above, but also Tobi, and the clay bombs across the battle field from below.
He actually ended up using their plan against them. Sasuke using his intelligence to figure things out isn't luck. The battle was thorough explained by Sasuke, both Deidara moves, and his own.
Sasuke's advantage was lightning style - Deidara's was being a Long Range fighter (Sasuke was a close-mid range fighter), having Tobi to help him, and having the element of surpise (Sasuke had no idea that he would fight them, whereas they specifically targetted him before hand and made preparations.)
Additionally, since Tobi was there, Sasuke obviously had to think of the possibility of him attacking him at any moment, and Deidara was aware that Sasuke had the Sharingan, and already had counters ready for it.