Transaction spam attacks can be avoided with NFT transactions by implementing gas fees and limit parameters. Gas fees are the amount of cryptocurrency paid to execute a transaction on the blockchain and placing a threshold limit on the number of transactions that can be executed within a specific timeframe can help prevent spam attacks. Additionally, NFTs can implement a whitelist system that restricts transactions to only those who have been pre-approved, adding an extra layer of security to prevent spam attacks. Finally, NFT marketplaces can also implement anti-spam measures such as captcha codes and advanced security protocols to protect users from malicious actors.