The short answer is yes, the New York Times could be sued for publishing part of Donald Trump's 1995 tax return, revealing that his loss that year was so large it could have allowed him to avoid paying taxes for up to 18 years. And one of Trump's lawyers, Marc E. Kasowitz, has already threatened the paper in a letter stating that disclosure of any of his returns would "prompt initiation of appropriate legal action." He has a potential case—federal law prohibits "any person" from printing and publishing tax return information without the permission of the taxpayer. Whoever leaked the returns to the Times is also in potential legal trouble, since leaking confidential returns is punishable by a $5,000 fine, up to five years in jail, or both.
But it's almost certain that the Times would make a First Amendment case, similar to what it did with the famous Pentagon Papers case, arguing that the publication of such information serves the public interest.
Back in 1924, the Times and other papers published front-page articles revealing how much some of the wealthiest Americans—including John D. Rockefeller, Henry Ford, and J.P. Morgan—paid in federal taxes. The next day, the Chicago Tribune revealed details in the tax returns of prominent actors including Charlie Chaplin, Douglas Fairbanks, and Gloria Swanson. The disclosures promoted then-President Calvin Coolidge to push for a change in the law, which tightened the rules surrounding disclosure in 1926.