The SDLP leader Mark Durkan has won the Foyle seat. He took 21,119 votes compared to 15,162 for Sinn Fein's Mitchel McLaughlin.
Mark Durkan wins Foyle for his party
The border seat was one of the last great prizes for republicans and it had been thought the contest might be much closer.
However, the figures do reveal a big reduction in the SDLP majority of 24,538 to Sinn Fein's 12,988 in 2001.
Much of that was a huge personal vote for the then SDLP leader John Hume.
Speaking after the result was announced Mr Durkan said the party had proved the pundits wrong.
"I was written off. The SDLP was written off. People called this election two or three nights ago.
"I know it is a bit of a Jose Mourinho tactic to do it and show those sorts of tactics. But the fact is like Jose Mourinho, the result wasn't as it was called."
He said he felt "vindicated at a personal level and at a party level".
Mr Durkan said he had "learned the lesson of taking voters for granted".
Earlier on Friday, the SDLP scored an unexpected electoral success when they took the South Belfast seat from the Ulster Unionists.
However, they lost Newry and Armagh to Sinn Fein.
Mr Durkan succeeded John Hume as the SDLP leader in 2001.
He is a former Derry City councillor, a Foyle assemblyman and one of the party's main strategists.
He recently became a father for the first time.
Mitchel McLaughlin is the Sinn Fein party chairman.
In January 2005 he rejected calls to resign over remarks he made about an IRA murder victim.
He told an RTE television programme that the killing of Jean McConville - one of the Disappeared - was not a criminal act.
His remarks were seen as possibly damaging for his electoral fortunes and were raised again during the campaign.