The tweet, which was copied and shared widely before being deleted, came a day after the Twitter accounts of a number of major news organizations, chief executives, government agencies and other high-profile users were hijacked.
"Based on our investigation, we have determined that our Twitter account was hacked by an external source. We took swift action to secure it, and we apologize this tweet was sent through our corporate McDonald's account," McDonald's spokeswoman Terri Hickey said in a statement.
Corporate accounts are attractive targets due to their large followings and the media attention that errant tweets can attract. Twitter Inc allows for two-factor authentication, a security feature that would deter many attempts to seize an account.
Twitter declined comment on Thursday citing "privacy and security reasons".
The tweet sent from @McDonaldsCorp on Thursday morning read: "@realdonaldtrump You are actually a disgusting excuse of a President and we would love to have @BarackObama back, also you have tiny hands."
Trump did not respond to the incident on Twitter.
High-profile Twitter accounts were hijacked on Wednesday to send anti-Nazi messages in Turkish in the midst of a diplomatic spat between Turkey, the Netherlands and Germany. Twitter said on Wednesday that the source of that attack was a third-party app, whose permissions have since been removed.
Trump, one of the more fast-food friendly presidents in recent years, had tweeted pictures of himself eating food from McDonald's and other chains during the U.S. election campaign. A 2002 ad campaign featured Trump and the chain's Grimace mascot promoting an "amazing" $1 deal for McDonald's since-discontinued Big N' Tasty burger.
The incident came as McDonald's is bolstering its digital capabilities with mobile and kiosk ordering to help modernize the 60-year-old chain.
Analysts said the hack raised questions about security at Twitter, but was unlikely to do much damage to the restaurant chain's brand.
"As long as Trump doesn't tweet at them directly, which could be pretty disastrous, this will be a short-term thing for them," said Mike Froggatt, director of intelligence at L2, which monitors the digital performance of brands.
"Twitter trending topics last for maybe 6 hours, a backlash for 10 to 12 hours and then it goes and the herd moves on," said Froggatt.
The message from the account of the world's largest restaurant chain caused a sensation on Twitter, where users shared copies of the deleted tweet and offered jokes and comments.
Vanessa Veasley and other users speculated that Trump supporters could attempt to launch a boycott of the chain, as they threatened to do when Starbucks Corp Chief Executive Howard Schultz vowed to hire 10,000 refugees after Trump's first executive order temporarily banning refugees from certain countries.
"McDonald's already deleted the tweet? lol Well at least Trump supporters can finally boycott something they can actually afford," Veasley (@VanessaVeasley) wrote.
Other users praised the fast-food chain, which has been fighting to reverse two straight years of customer traffic declines.
"Suddenly I want a Big Mac, well done @McDonalds," tweeted Shay Steward Bouley (@blackgirlinmain).
Some Trump supporters said McDonald's had not done enough to atone for the tweet and advocated for a boycott.
"Hey @McDonaldsCorp YOU can't just undo a tweet!!!
Since you don't support America, Americans will not support YOU!!! #BoycottMcDonalds," wrote Deborah Brewer (@Debbie92083).
McDonald's is not the only high-profile company to be compromised with fake tweets over the years. Brands including Burger King, Jeep and Sony Music also have been hit. - Reuters