He returned earlier to the capital, Juba, to take the post in a new unity government led by President Salva Kiir.
Tens of thousands have been killed and about two million people left homeless in the conflict in South Sudan, which became independent in 2011.
Mr Machar fled Juba at the start of the civil war in December 2013.
He had been accused of trying to organise a coup, which he denied - but it set off a round of tit-for-tat killings, which developed into a full-blown conflict.
Both men, whose personal falling out has resulted in more than two years of bitter conflict in the world's youngest nation, spoke optimistically about the future, addressing the media at the swearing-in ceremony.
Analysis: James Copnall, BBC News, Juba
There were shouts of joy at the airport as his supporters greeted Riek Machar, back in the capital for the first time in more than two years.  The atmosphere during the ceremony to swear him in as first vice-president was noticeably more tense.
President Salva Kiir and his new deputy described each other as brothers, but there were not many smiles. Both talked of the need for reconciliation, to rebuild a devastated nation. A government of national unity should be formed in the next few days.
If this is done, in theory donors will start stumping up money - crucial as the economy is at rock bottom.
Among its first challenges will be to overcome the mistrust between the two sides.  The fact that there are other rebel groups which have not signed the peace deal could also prove significant.
"I am very committed to implement this agreement so that the process of national reconciliation and healing is started as soon as possible," Mr Machar told journalists at the presidential palace in Juba, AFP news agency reports.
Meanwhile, President Salva Kiir welcomed Mr Machar back to South Sudan, twice referring to him as his "brother", according to a transcript of his speech published by the local Radio Tamazuj news website.
"I have no doubt that his return to Juba today marks the end of the war and the return of peace and stability to South Sudan," Mr Kiir said.
Riek Machar: What you need to know
South Sudan's Riek Machar profiled
The president also offered a rare apology, to the South Sudanese people and to the international community for delays in implementing the peace agreement, which was signed last August.
Earlier Mr Machar, wearing a light-coloured shirt, was greeted by ministers and diplomats as he stepped out of his plane.
Addressing the media, he said his main priorities were to ensure a permanent ceasefire, to stabilise the economy and ensure humanitarian access throughout South Sudan.
"I'm happy to be back... The war was vicious. We have lost a lot of people in it and we need to bring our people together so that they can unite," he said.
The US Ambassador to the UN, Samantha Power, described Mr Machar's return as "the best hope that South Sudan has had in a very long time'', but warned of the need to keep up the pressure on both sides to make sure the peace deal was properly implemented.
UN Secretary-General Ban Ki-moon called for the new unity government to be formed immediately.
The civil war broke out over tensions between Mr Kiir and Mr Machar, who was sacked as vice-president in July 2013.
Both sides have continued to clash despite a ceasefire signed last August.
South Sudan: The world's youngest country
South Sudan profile
South Sudan's rebel leader Riek Machar has been sworn in as vice-president in a boost for a peace deal aimed at ending more than two years of conflict.