A Share Purchase Agreement (SPA) is a contract to buy/sell shares. It is a key document in an M&A transaction.
SPA defines terms of the transaction (shares, price, obligations of the parties etc). Buyer usually asks guarantees from the vendor that tax liabilities have been properly accounted and issues disclosed and that there are no hidden tax risks.
The interests of vendor and buyer in this respect are usually divergent, making this area an important part of the negotiation process.