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.
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.
Evacuations in United States ahead of Hurricane Florence
There was also concern over crops. "It's going to be bad", said Woody White, chairman of the New Hanover County Commissioners. At least 1.7 million people in the Carolinas and Virginia have been warned to evacuate, and others are hunkering down.
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.
Landslide on Greek island beach injures three
British woman Wendy Thorpe said she was on a boat with her daughter when the cliff collapsed and there was an "almighty crash". Video footage of the incident shows people running in panic as a large sheet of rock fell off the rock wall.
Apple launches the iPhone XS and iPhone XS Max
There's no home button on any of them - love it or hate it, Apple is putting the fingerprint reader permanently out to pasture . At the same time Apple also refreshed its Apple Watch range and tweaked its HomePod smart speaker, but nobody seems to care.
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.