* Ceasefire begins within 24 hours
* First face-to-face meeting since conflict began
* Foreign powers demanded deal to avert genocide (Adds U.S. reaction, paragraphs 6 and 9)
By Aaron Maasho
ADDIS ABABA, May 9 (Reuters) - South Sudanese President Salva Kiir and rebel commander Riek Machar signed a ceasefire deal on Friday after coming under growing international pressure to end ethnic fighting that has raised fears of genocide.
Friday's deal was made at a meeting in Ethiopia that was the first time the two men had met face-to-face since violence erupted in December following a long power struggle. Kiir and Machar, both Christians, shook hands and prayed together.
The men agreed that a transitional government offered the "best chance" to take the country towards elections next year, though there was no immediate decision on who would be part of an interim administration.
"Now that we have come to our senses ... dialogue is the only answer to whatever problem we had," Kiir said after a signing ceremony in Addis Ababa's presidential palace. "We will continue to move in the right direction."
The truce will take effect within 24 hours and both sides agreed to disengage their forces and refrain from any provocative actions, said Seyoum Mesfin, lead mediator from the regional IGAD grouping.
"Today's agreement to immediately stop the fighting in South Sudan and to negotiate a transitional government could mark a breakthrough for the future of South Sudan," U.S. Secretary of State John Kerry said in a statement.
A previous ceasefire accord struck in January swiftly fell apart, with each side blaming the other for fighting that has exacerbated deep-rooted tensions between Kiir's ethnic Dink community and Machar's Nuer group.
Western powers had demanded a new deal. Kerry and U.N. Secretary-General Ban Ki-moon had both visited the Texas-sized country in the past week, part of a diplomatic push by regional and world leaders still haunted by Rwanda's 1994 genocide.
"I saw with my own eyes last week the stakes and the struggles in a new nation we helped courageous people create. The people of South Sudan have suffered too much for far too long," Kerry added in Friday's statement.
The United States has already slapped sanctions on two commanders on opposing sides of the conflict, a sign of its growing frustration with the leaders of Africa's youngest country, which declared independence from Sudan in 2011.
Cranking up the pressure ahead of the Friday's meeting, the European Union also threatened sanctions against anyone blocking the peace effort.
Fighting erupted in South Sudan's capital Juba in mid-December between soldiers loyal to Kiir and those backing Machar and quickly spread across the country.
Kiir's government at the time accused Machar of treason - a charge again denied by the rebel leader, who on Friday swapped his military fatigues for a dapper suit.
Thousands of people have been killed and more than a million forced from their homes. Troops on both sides have committed murder, rape and other sexual abuses, a U.N. report said.
The unrest has caused oil output to be cut by a third to 160,000 barrels per day.
"I had no reason to bring South Sudan to war," Machar told Ethiopian Prime Minister Hailemariam Desalegn and envoys.
Kiir and Machar have been locked in a long-running power struggle that intensified after the president sacked Machar as his deputy in July.
Negotiators from the two sides will now hammer out the terms of an interim government that will guide the country of 10 million people to elections in 2015, the agreement said.
Those discussions may be hard fought. Machar told Reuters in January that Kiir had lost the people's trust and should resign - a demand some in his camp were still making earlier on Friday.
But Kiir's ministers say the president would not quit.
One Western diplomat said there was a push for the peace process to include former political prisoners, the church and local civil society groups.
"You can't leave it to warring guys because then it's basically about who gets what part of the cake," said the Juba-based Western diplomat. "These (talks) are a fundamental review of where the country is going and on what basis." (Additional reporting by Drazen Jorgic in Juba and Sandra Maler in Washington; Writing by Richard Lough; Editing by Mohammad Zargham)
Our Standards: The Thomson Reuters Trust Principles.