A brawl broke out injuring at least 10 people, including the Social Democrat leader Zoran Zaev, who was left with blood pouring down his face.
The protesters, supporters of ex-Prime Minister Nikola Gruevski's VMRO party, are demanding new elections.
Politics in the former Yugoslav republic has been deadlocked since an inconclusive election in December.
But the crisis goes back further, to a phone-tapping scandal two years ago.
Mr Zaev has created a coalition with ethnic Albanian parties, but his attempts to form a government have been blocked by the president.
Macedonian nationalists have been protesting on the streets since Mr Zaev tried to form the coalition.
Ethnic Albanians make up around a quarter of the country's population.
The people who stormed parliament were angered by the coalition's decision to elect Talat Xhaferi as speaker.
They fear moves to improve the status of Albanians threaten Macedonian unity.
Some of the 200 protesters were masked. Witnesses saw broken glass on the floor and traces of blood in hallways.
Police fired stun grenades to disperse protesters and allow politicians to exit the parliament building.
A statement from the US Embassy in Macedonia, published on Twitter, said: "We condemn the violence in the strongest possible terms.
"It is not consistent with democracy and is not an acceptable way to resolve differences."
The secretary general of Nato, Jens Stoltenberg, tweeted that he was "shocked" by the "attacks".
"All parties should respect democratic process and engage in dialogue, not violence," he wrote.
"Violence has NO place in Parliament. Democracy must run its course," tweeted European Union Commissioner Johannes Hahn.
Skopje has also seen regular protests against the coalition by demonstrators who believe it will damage the country's national unity.
Macedonia came close to civil war in 2001 after an Albanian uprising.
|Social Democrat leader Zoran Zaev was among those injured after a fight broke out. EPA|
Macedonia: protesters storm parliament and attack MPs
Around 200 demonstrators, many wearing masks, broke through a police cordon and entered Macedonia’s parliament, attacking MPs in protest at the election of a new speaker despite a months-long deadlock in talks to form a new government.
The protesters stormed parliament on Thursday night after the country’s opposition Social Democrat party and others representing Macedonia’s Albanian ethnic minority voted for a new speaker. Shouting and throwing chairs, the protesters attacked MPs, including the opposition leader, Zoran Zaev.
Television footage showed Zaev bleeding from the forehead and other Social Democrat MPs surrounded by protesters waving national flags, shouting “traitors” and refusing to allow them to leave. Broken glass littered the floor and traces of blood were seen in hallways.
Police later fired flash grenades in an attempt to disperse protesters outside the parliament and clear the way for the evacuation of politicians still in the building.
In a televised address, the country’s president, Gjorge Ivanov, called for calm and said he had summoned the leaders of the country’s main political parties for a meeting on Friday. Ivanov said the constitution had been been violated and appealed “for reasonable and responsible behaviour”.
Macedonia has been without a government since last December, when former prime minister Nikola Gruevski’s conservative party won elections, but without enough votes to form an administration.
Coalition talks broke down over ethnic Albanian demands that Albanian be recognised as an official second language in a country where a quarter of the population is ethnic Albanian.
Zaev has been seeking a mandate to form a government for months, after reaching an agreement with an ethnic Albanian party, the Democratic Union for Integration, to form a coalition. However, Ivanov refused to hand him the mandate.
The assembly of the republic of Macedonia, as the Balkan nation’s parliament is known, has been deadlocked for three weeks over the election of a new speaker. Zaev had suggested earlier on Thursday that one could be elected outside normal procedures, an idea immediately rejected by the conservative party as an attempted coup.
Zaev went ahead with the vote, and a majority in parliament elected Talat Xhaferi, a former defence minister and member of the Democratic Union for Integration.
Police said about 10 officers were injured during the melee and reinforcements were sent to assist those inside the parliament building.
The protesters who stormed parliament were among a group of demonstrators who have been holding rallies nightly for the past two months in the streets of Skopje and other cities. Many are supporters of Gruevski.
EU’s foreign policy chief Federica Mogherini called for “calm and restraint”
“The acts of violence in the Parliament are wholly unacceptable,” Mogherini said in a statement.
The European Union enlargement commissioner, Johannes Hahn, condemned the violence, saying in a tweet: “Violence has NO place in parliament. Democracy must run its course.”
Sweden’s ambassador to Macedonia, Mats Staffansson, speaking on behalf of other European diplomats, reminded the country’s politicians of the need for dialogue and said: “It is the responsibility of the police of this country to make sure that this kind of violence does not happen.”
Macedonian police fire stun grenades after protesters storm parliament
Macedonian police fired stun grenades on Thursday evening to disperse protesters outside the parliament and clear the way for the evacuation of lawmakers still in the building.
Protesters stormed into Macedonia's parliament and assaulted the leader of the Social Democrats on Thursday after his party and ethnic Albanian allies voted to elect an Albanian as parliament speaker, witnesses said.
Live television footage showed Social Democratic leader Zoran Zaev with blood trickling from one side of his forehead, not long after he announced that the majority coalition led by his party had elected Talat Xhaferi as parliament speaker.
A Reuters witness saw nationalist protesters angered over Xhaferi's election beating up another lawmaker in parliament. Broken glass littered the floor and traces of blood were seen in hallways.
Some of the roughly 200 protesters inside the parliament were masked. Witnesses said that police entered parliament after the disturbances erupted but did not immediately seek to quell the protesters.
EU's foreign policy chief Federica Mogherini called for "calm and restraint"
"The acts of violence in the Parliament are wholly unacceptable," Mogherini said in a statement.
Police said eight people including an ethnic Albanian lawmaker were injured in Thursday's violence.
President Gjorge Ivanov invited leaders of all political parties for a meeting in his office on Friday.
Ivanov refused to give mandate to Zaev who has forged the coalition with ethnic Albanian parties to form the government saying it threatened the sovereignty of Macedonia.
Macedonia has been without a functioning government since 2015 when the country sank into political turmoil over a wiretapping scandal that brought down the ruling nationalist VMRO-DPMNE party bloc.
Elections were held in December 2016 but no government has been formed yet.
Zaev's parliamentary alliance has triggered daily street protests by Macedonian nationalists in Skopje. Ethnic Albanians comprise a third of the country's population.
VMRO-DPMNE lawmakers challenged the legality of Thursday's vote, saying it was not carried out electronically as is the usual case because the parliamentary session had formally ended.
The current crisis is the worst since 2001 when Western diplomacy helped drag the country of 2.1 million people back from the brink of civil war during an ethnic Albanian insurgency, promising it a route to membership of the EU and NATO.
But Macedonia has made little progress in that direction due to a name dispute with Greece.
"I condemn the attacks on MPs in Skopje in the strongest terms. Violence has NO place in Parliament. Democracy must run its course," the EU commissioner in charge of enlargement, Johannes Hahn, said in a tweet.
"This is the time for dialogue and not for violence," Mats Staffansson, Sweden's ambassador to Skopje, told reporters on behalf of EU and U.S. legations in Macedonia.
Shortly before protesters charged into parliament, Zaev told reporters, "With 67 votes we have elected a new parliament speaker. I want to congratulate Talat Xhaferi and good luck to all of us."
Xhaferi became the first ethnic Albanian parliament speaker in Macedonia since the small Balkan country won independence from then-Yugoslavia in 1991.