The lira firmed to 6.01 against the dollar following the decision, from more than 6.4176 beforehand.
Erdogan again described interest rates as a "tool of exploitation" but vowed that "we can not be taken advantage of".
"It was a big surprise to us, but probably to every Turkey-watcher", said Nora Neuteboom, an economist at ABN Amro, saying the move was a "positive signal" with the bank wanting to show its independence and commitment to fight inflation.
Before today's interest rate decision, Mr Erdogan announced he was banning the use of foreign currencies in property sales, rental contracts and leasing transactions and ruled all such transactions must now be made in lira.
Cuomo holds 41-point lead over Nixon in NY
He's offering to pay for the Nixon campaign to send out its own mailer but it's unclear whether there's time before election day. The mailer says Nixon "won't stand strong" for Jewish residents and has been silent on rising anti-Semitism.
The Central Bank of the Republic of Turkey (CBRT) raised the rate from 17.75% to 24%, significantly higher than the analysts' consensus of 21%, and in apparent defiance of the president, who has regularly expressed resistance to raising rates.
It said: "Accordingly, the committee has chose to implement a strong monetary tightening to support price stability".
It vowed the tight stance in monetary policy would be "maintained decisively until inflation outlook displays a significant improvement".
The Turkish lira began to recover shortly after the rate hike, strengthening by 3% to 6.16 against the dollar.
"Turkey needs structural reforms to increase productivity, to decrease its dependence on short-term portfolio flows and to decrease the rigidness in the labour market".
Currently, the interest rates are below the annual inflation level in Turkey. "If you say ´inflation is the cause, the rate is the result´, you do not know this business, friend", he added. "Erdogan´s speech. was meant to put distance between himself and the (bank´s) decision". In one direction it could hear the siren call of investors craving higher interest rates to draw a line in the inflationary sand and stop the lira's collapse.
The rate rise comes on the same day as the Bank of England left the interest rate untouched at 0.75%, citing heightened risks to global growth as a result of volatility within emerging markets, as well as tensions between the United States and China.
Washington has imposed sanctions on two Turkish ministers and doubled tariffs on steel and aluminum imported from the country.
Carolina coast braces for 'Mike Tyson punch' from hurricane
Many people in coastal communities have followed the mandatory evacuation orders, but some are vowing to stay put and ride it out. Those winds can heard howling at the Frying Pan, a decommissioned lighthouse 55km off the North Carolina coast.
FDA Gets Tough on Juul, Other E-Cigarette Makers
The FDA will also look closely at "straw purchases", in which adults visit web-based stores and buy in bulk to resell to minors. The agency is giving e-cigarette companies 60 days to come up with a plan for reducing use of their products among minors.
Hurricane Florence weakens, but still a strong flood threat
Duke Energy Corp expected between 25 percent and 75 percent of its 4 million customers would lose power in the Carolinas. More than 80,000 people were already without power as the storm approached, and more than 12,000 were in shelters.