Nigel Farage's party - which dominated in England - picked up 10.4% of the Scottish vote, giving them the sixth and final seat available north of the border.
The declaration was delayed until today to allow for counting in the Western Isles, although the arithmetic from last night meant today's conclusion was inevitable.
It caps a remarkable European election for Ukip, which saw it stretch ahead of Labour and the Conservatives with the highest share of the vote across Britain as a whole.
In Scotland, the SNP and Labour remain on two seats each while the Tories keep their single seat.
The Lib Dems were beaten behind the Greens and lost their only seat in a dreadful UK-wide result for Nick Clegg's party.
The complicated proportional voting system meant that the SNP had to extend its share of the vote beyond one-third of the total in Scotland if it had any chance of keeping Ukip out.
But Alex Salmond's party fell just short with 389,503 votes - a 28.9% share.
The Green Party had also hoped to pick up its first seat and block Ukip, but ended with 108,305 vote (8%).
Labour saw its vote increase by five points to 25.9% with 348,219 votes, keeping its two MEPs, while the Conservatives held on to their single seat with 231,330 votes (17.2%).
The Liberal Democrats won just 95,319 votes (7.1%) and lost their only MEP in Scotland while being beaten to sixth place behind the Greens.
Turnout in Scotland was just 33.5% - which is still an improvement on 2009 when only about 28.5% of the electorate voted.
Across Scotland, turnout peaked at 43.1% in East Renfrewshire and 41.6% in Edinburgh. It was lowest in North Lanarkshire at 28.1%.
Ukip's main candidate, David Coburn, now an MEP, arrived at the central declaration point in Edinburgh last night and, in typically combative fashion, declared Alex Salmond to be the Robert Mugabe of Scottish politics, based on recently published land reform laws.
Mr Coburn, whose address was declared as being in Kensington, London, vowed his party would "stand up to Salmond and his nasty little dictatorship".
He said: "This result says people in Scotland are as worried about the same things as everyone else in the rest of the United Kingdom.
"We all have the same problems that need to be resolved and, quite frankly, Mr Salmond seems to think that Scotland is so different from everywhere else - well, it's not.
"In England the people are just the same as the people in Scotland, they're just as nice, just as pleasant, and they have the same problems and they need to be resolved."
He said the campaign for Scottish independence was a ridiculous idea.
"I'm a patriotic Scot and, as far as I'm concerned, the union between Scotland and England has lasted for 300 years, and has enabled both countries to punch above their weight, and we have a stable currency - what's not to like about that?" Mr Coburn argued.
"I'd like to see both Scotland and England leaving the EU together and running our own affairs.
"I'd like to see less Westminster and less Holyrood in everybody's lives. I think that would be a good thing for Scotland.
"I want to get the weight of the socialist Scottish state off the back of the Scottish entrepreneur. And, most of all, I want to see every child in Scotland get a thoroughly good education."
Ukip's shock breakthrough gives the Scottish independence campaign a serious problem, he said.
"Ukip are not going to sit down and be quiet like all the other parties," he continued.
Mr Coburn added: "The Ukip revolution has now come to Scotland. I will do my best to make sure I highlight the problems of the European Union. When I'm in Brussels I will do my best to make sure Scottish business and Scottish people know the daft schemes they're cooking up there to make our lives infinitely more awkward.
"My second mission will be to make myself redundant. I want to get out of the European Union at the first available opportunity, and that I will do.
"On the bigger picture, Ukip has done well on the British stage as a whole and the fact that we're winning in Scotland and got such a good score in Scotland - getting up to 14% in some areas - is something we're very proud of."
Mr Coburn said he will fight hard against the campaign for Scottish independence.
He pledged to ensure every Scottish soldier serving abroad gets a vote in the referendum.
Ian Hudghton, re-elected for the SNP, said his party won overall.
"We also have the opportunity in September to ensure that we transform our experience as members of the European Parliament, and as a country in the European Union, by voting 'yes' and becoming a normal independent member state with the right to representation as a nation, as a government, as well," he said.
Returning Labour MEP David Martin said SNP leader Alex Salmond has allowed Ukip in by polarising the debate in Scotland.
"I'd like to suggest to David Coburn that the first thing he does when he sits down and recovers from the champagne is write a letter to Alex Salmond because there is no doubt in my mind that Alex Salmond's decision to polarise the campaign, the Scottish debate, between two extremes is why David Coburn is with us today as a member of the European Parliament," he said.
Mr Martin, flanked by Labour's other returning MEP Catherine Stihler, said: "We knew before we set out on this campaign that many people up and down the country are suffering real hardship under the present policies.
"Catherine and I are determined to use the platform that Scottish people have given us in the European Parliament to continue to campaign for Scottish jobs, to continue to campaign for social justice, to continue to work for fairness at work, and we're committed to work hard for all the people of Scotland."
He offered his commiserations to outgoing Lib Dem George Lyon.
"I'm particularly sorry for George Lyon," he said.
"George was a very conscientious member of the European Parliament and his demise reflects the demise of his party, not his own efforts inside the European Parliament."
Tory MEP Ian Duncan, who takes over from the retired Struan Stevenson, said his party's vote is the highest it has been for 25 years.
"We've bucked the national trend and it is a reminder that we have much to offer the people of Scotland," he said.
"People are concerned about Europe and they want change. They want change to make Europe work for them, not against them, and I believe we have harnessed that concern and that feeling in a very simple way."