"I declined to answer the questions under the rights and privileges afforded to every citizen under the United States Constitution," Trump said in a statement.
The Constitution's Fifth Amendment offers protection against self-incrimination.
New York State Attorney General Letitia James is looking into whether the Trump Organization inflated real estate values. Trump and two of his adult children, Donald Trump Jr. and Ivanka Trump, fought to avoid testifying but lost.
James has said her investigation uncovered significant evidence that the Trump Organization, which manages hotels, golf courses and other real estate, overstated asset values to obtain favorable loans and understated the values to get tax breaks.
Trump, a Republican, has denied wrongdoing and called the New York investigation politically motivated. James is a Democrat.
Trump in his statement said: "I once asked, "If you're innocent, why are you taking the Fifth Amendment?" Now I know the answer to that question. When your family, your company, and all the people in your orbit have become the targets of an unfounded, politically motivated Witch Hunt supported by lawyers, prosecutors, and the Fake News Media, you have no choice."
He added, "If there was any question in my mind, the raid of my home, Mar-a-Lago, on Monday by the FBI, just two days prior to this deposition, wiped out any uncertainty. I have absolutely no choice because the current administration and many prosecutors in this Country have lost all moral and ethical bounds of decency."
The FBI searched Trump's Florida estate on Monday, an escalation of the federal investigation into whether he illegally removed records from the White House as he was leaving office in January 2021.
A spokeswoman for James did not immediately respond to a request for comment, nor did a lawyer for Trump.
Trump had raised his fist as he left Trump Tower on Wednesday morning, wearing a blue suit with a flag pin on his lapel, before heading to the attorney general's office in lower Manhattan. New York City police officers and Secret Service personnel had stood guard as the motorcade transporting Trump arrived.
"I did nothing wrong, which is why, after five years of looking, the Federal, State and local governments, together with the Fake News Media, have found nothing," Trump said in his statement.
The deposition is not public.
Trump has been flirting publicly with the question of running again for president in 2024 but has not said clearly whether he will do so.
The warrant to search Trump's Florida estate relates to the National Archives and Records Administration, which is charged with safeguarding presidential records that belong to the public, and whether there were classified documents at Trump's Mar-a-Lago resort in Palm Beach, Florida, according to a person familiar with the matter.
Trump has had to deal with a slew of legal troubles since he left office, after his supporters stormed the U.S. Capitol on Jan. 6, 2021, in an unsuccessful bid to overturn his election loss. Trump continues to claim falsely that the election was stolen through widespread voting fraud.
(Reporting by Kanishka Singh in Washington and Karen Freifeld in New York; Editing by Will Dunham, Robert Birsel, Noeleen Walder and Andrew Heavens)
By Karen Freifeld and Kanishka Singh