By David Schwartz

PHOENIX (Reuters) - A divided Arizona Senate passed a key piece of President Barack Obama's Medicaid expansion agenda on Thursday, handing Republican Governor Jan Brewer a policy victory over fierce opposition from conservatives in her party.

By an 18-11 vote, the Senate approved the bill with the backing of a bipartisan coalition of lawmakers that will add hundreds of thousands of the state's poorest residents to the Medicaid healthcare rolls, but was opposed by conservative Republicans.

The state House of Representatives approved the same measure by a 33-27 vote early on Thursday after a marathon debate.

Brewer, who has been a feisty opponent of the Obama administration over its immigration policies, said the addition of $1.6 billion in federal funds for the Affordable Care Act expansion was the right move. She is expected to sign the legislation.

"By joining me in extending health coverage to hundreds of thousands of Arizonans, legislators of my own party have come under sharp criticism in some quarters," Brewer said in a statement. "But I also know this in my heart: The great majority of Arizonans stand with us," she added.

She thanked lawmakers who pulled together to approve the bill, saying they acted with "courage and conviction" - an apparent reference to the moderate Republicans who broke party ranks to support the act slammed by conservatives as "Obamacare."

But critics said the legislation could be a costly mistake if the federal funds run dry.

"I think that Obamacare is the biggest mistake that we've made in our country," said Republican State Senator Kelli Ward, who voted against the bill. "And bringing it into Arizona is the biggest mistake that we're going to make."

Brewer, a staunch conservative in this desert southwestern state, has said Arizona had no choice but to agree to provide care to 300,000 poor and disabled residents through the federal-state program.

She said the decision would also protect rural and other hospitals from being jeopardized by the rising costs of paying for uninsured patients, inject $2 billion into the state's economy and create thousands of jobs.

But she added that any plan would include a "circuit breaker," that would call an automatic halt to the expansion if the federal reimbursements decrease.

Under the Affordable Care Act, the federal government agreed to increase Medicaid eligibility and cover 100 percent of the costs for three years, after which coverage would be reduced to 90 percent.

Last June, the U.S. Supreme Court upheld Obama's healthcare overhaul but allowed states to opt out of a provision expanding the Medicaid program.

If signed into law Arizona would become the 24th state moving forward to participate in the Medicaid expansion, according to the Kaiser Family Foundation, a California-based nonprofit that tracks the issue. Twenty states are not participating with the balance undetermined, the group said.

Brewer became a leading Obama administration antagonist when she signed Arizona's tough crackdown on illegal immigration in 2010. One of its key provisions, one that allowed police to question those they stopped and suspected were in the country illegally about their immigration status, was upheld by the U.S. Supreme Court.

(Editing by Tim Gaynor and Lisa Shumaker)