* Presidents of Iran, Brazil, Argentina attend
* Election council agrees to expand audit of results
* Opposition insists challenger Capriles won (Adds details of Maduro speech, color from street)
By Daniel Wallis and Brian Ellsworth
CARACAS, April 19 (Reuters) - Nicolas Maduro was sworn in as Venezuela's president on Friday at a ceremony attended by leaders from Iran to Brazil after a decision to widen an electronic audit of the vote took some of the heat out of a dispute over his election.
Maduro, a bus driver-turned-foreign minister who became the late Hugo Chavez's chosen successor, narrowly beat opposition challenger Henrique Capriles in the election last Sunday.
Capriles refused to accept the result, alleged widespread irregularities, demanded a full recount and called his supporters onto the streets in protest.
The government says eight people were killed in post-election violence and Maduro blamed the deaths on Capriles, although the opposition says Maduro allies staged some incidents to distract attention from the dispute over balloting.
Maduro took the oath of office alongside a large framed photo of the socialist Chavez, who led Venezuela for 14 years before losing a battle against cancer last month.
"I swear, on the eternal legacy of our founding fathers ... on the eternal memory of our supreme commander, that I will uphold this constitution," Maduro said.
In his first speech as president, which coincided with Venezuela's celebration of its declaration of independence, Maduro offered a sentimental tribute to Chavez, the fiery and charismatic socialist whose death from cancer in March triggered Sunday's vote.
"Every day I wake up thinking about him, and I go to bed thinking about him, in need of his guidance," Maduro said.
He at times seemed to reach out to the opposition after beating Capriles by less than 2 percentage points compared to Chavez's 11-point margin of victory in 2012.
"I call on those who for whatever reason did not vote for the candidate of the fatherland, I offer you an olive branch, I will work with you," he said.
But at other times he compared his adversaries to those who persecuted Jews in Germany and accused them of sowing violence in the wake of the vote in an attempt to snatch power.
In an embarrassing breach of security, a young man in a red jacket ran up to the podium, pushed Maduro out of the way and shouted "Nicolas, my name is Yendrick, please help me," into the microphone. He was tackled by bodyguards.
"Security has failed completely. They could have shot me up here," said Maduro upon resuming his speech.
Overnight, the 50-year-old Maduro attended a last-minute meeting of South American leaders in Peru to discuss the post-election crisis. They congratulated him on his victory, and called on both sides to reject violence.
While he was in Lima, Venezuela's electoral authority said it would widen to 100 percent an audit of electronic votes from a previous audit that reviewed 54 percent of the machines.
Venezuelans vote electronically, but the machines also print out paper receipts of each vote that are kept in boxes. The audit involves counting the paper ballots at some stations to ensure they are consistent with the machine-tallied results.
Capriles, who insists the opposition's figures show he won, accepted the CNE's decision although it fell short of the full manual recount he had wanted.
Even so, opposition legislators boycotted Maduro's inauguration. Capriles urged supporters to play salsa music and bang pots and pans to protest the event, following similar protests since the night of the election.
"Let's hear that salsa all over Venezuela! The voice of the people! This is a 'for now' government," Capriles tweeted.
In upscale eastern Caracas, celebratory fireworks drowned out opposition protests.
The date for the start of the wider audit is to be announced next week. It is expected to take 30 days.
The CNE's decision considerably eased tensions after days of violence and angry allegations by both sides that their rivals were sending armed thugs into the streets to terrorize people.
Maduro's inauguration drew heads of state including Maduro's Brazil's Dilma Rousseff and Iran's Mahmoud Ahmadinejad, along with leaders of Chavez-era allies such as Bolivia, Uruguay and Nicaragua.
Ahmadinejad paid tribute to "the spirit and the soul of Commander Chavez, who had only love for all the peoples of the world" in comments to state television as he arrived at Congress, where the inauguration was held.
Russia and China, both involved oil projects in Venezuela's vast Orinoco belt region, sent delegations.
Thousands of government sympathizers surrounded Congress in downtown Caracas, dancing to upbeat music and clad in the Socialist Party's signature red T-shirts.
Vendors peddled trinkets including foam mustaches that Maduro supporters tape to their upper lips in imitation of his facial hair.
"The streets out ours; we've come to defend them from the right wing," said Carlos Poveda, 45, a merchant.
The unrest in Venezuela, just weeks after Chavez's death from cancer, has exposed the deep polarization of a country split down the middle between pro- and anti-government factions.
Maduro's administration accuses "fascist" Capriles supporters of going on a rampage, shooting people, attacking offices belonging to the ruling Socialist Party, and setting fire to government-run clinics staffed by Cuban doctors.
"My commander is still dead and his spirit is alive in Maduro," said Rosalba Navarro, 44, who works with a government social program for single mothers, at a military fairgrounds waiting for the start of an independence day parade.
"I only ask that he treat the opposition with an iron hand and if Capriles needs to go to jail, that he go to jail," she said, echoing calls by government officials that Capriles should be imprisoned for spurring violence over the last week.
Prominent Venezuelan human rights group Provea on Thursday questioned some of the alleged opposition attacks. It had been unable to find any evidence that the clinics, known as CDIs, were torched by opposition demonstrators.
Capriles, who has repeatedly called on his supporters to protest peacefully, has said the government was to blame for any violence because of its refusal to hold a recount.
"I asked for reports from all the country's municipalities about incidents at CDIs," he said on Twitter. "None were affected. Only sick minds would do something like this!" (Additional reporting by Deisy Buitrago and Girish Gupta; Editing by Kieran Murray and Eric Walsh)