Foreign Minister Luis Videgaray said such a tax would make Mexican imports more expensive for US consumers and they would end up paying for the wall.
The Mexican president earlier cancelled a visit to the US over the row of who would pay for the barrier.
The planned wall was one of Mr Trump's key election campaign pledges.
Earlier this week, the president signed an executive order to create a wall along the 2,000-mile (3,200km) US-Mexico border.
Speaking on Thursday, Mr Videgaray said: "A tax on Mexican imports to the United States is not a way to make Mexico pay for the wall, but to a way make the North American consumer pay for it through more expensive avocados, washing machines, televisions.''
He also stressed that paying for Mr Trump's wall "is not negotiable" for Mexico.
Earlier on Thursday, White House spokesman Sean Spicer said a 20% tax could generate approximately $10bn (£8bn) in tax revenue per year.
"Right now our country's policy is to tax exports and let imports flow freely in, which is ridiculous", he said, adding that the tax will "easily pay for the wall".
But Reince Priebus, the White House chief of staff, later said that the border tax is only one of several options being considered.
Border tax unacceptable - Will Grant, BBC News, Mexico City
President Enrique Pena Nieto would have been perceived as very weak if he had travelled to Washington for talks and for many here it would have been tantamount to accepting Mr Trump's central claim - that Mexico will pay for the US border wall.
If that is not up front, then it may come eventually - perhaps under the latest proposal being floated by Donald Trump's White House, a massive 20% border tax on Mexican imports.
As Mexico exports some $300bn of goods a year to the US, the impact of such a proposal would be felt across the country.
Furthermore, the idea of funding a wall through a new tariff is simply unacceptable to most ordinary Mexicans who view the wall as unnecessary, inhumane, expensive and ineffective.
As their elected leader, at least for the next 18 months, Enrique Pena Nieto was left with little option but to deliver that message to the White House - by not going there in person.
Enrique Pena Nieto (left) and Donald TrumpImage
The rift between the neighbours and trade partners has deepened just days into Mr Trump's presidency.
After Mexican President Enrique Pena Nieto pulled out of next week's summit, Mr Trump said the meeting would have been "fruitless" if Mexico didn't treat the US "with respect" and pay for the wall.
Earlier Mr Pena Nieto said he "lamented" the plans for the barrier.
In a televised address, the Mexican leader told the nation: "I've said time and again: Mexico won't pay for any wall."
Republican Senator Lindsey Graham warned that US consumers may wind up bearing the cost of the proposed tax.
"Any tariff we can levy they can levy. Huge barrier to econ growth", he wrote online.
"Build that wall" was one of Mr Trump's campaign rally slogans.
Mr Trump's executive orders also called for hiring 10,000 immigration officials to help boost border patrol efforts.
"A nation without borders is not a nation," Mr Trump said. "Beginning today the United States gets back control of its borders."