I'm no expert on the actual history or proof of Fermat's Last Theorem, but I'll try anyway.
According to a Numberphile video and Wikipedia, it was known that a consequence of proving the Taniyama-Shimura-Weil Conjecture was a proof of Fermat's Last Theorem. Simply, if you assumed Taniyama-Shimura was true, you had Fermat.
However, proving the conjecture seemed almost impossible. What Sir Andrew Wiles did was proving Taniyama-Shimura-Weil for a special case, which was later expanded to the more general case and became known as the Modularity Theorem, and then Fermat's became a corollary.