Attorney general nominee Loretta Lynch could finally earn a confirmation vote in the Senate this week after Democrats and Republicans struck a deal Tuesday on an unrelated bill against human trafficking, clearing a legislative logjam after more than a month.

The confirmation of Ms. Lynch, whom President Obama picked to replace Attorney General Eric H. Holder Jr., has been pending since late last year, but Republicans insisted on finishing the human trafficking bill first — and the trafficking bill has been stuck in a fight over abortion funding.

On Tuesday, both sides agreed to shelve the thorny abortion issue by rearranging money for a victims’ fund so it comes from existing health care money.

Congress could take final action on the trafficking bill Wednesday, and then Republicans could move on to Ms. Lynch as promised.

“There are no more excuses. We should vote to confirm Loretta Lynch as quickly as possible,” said Sen. Patty Murray of Washington, one of a number of Democrats who accused Republicans of slow-walking Ms. Lynch, who would be the first black woman to hold the nation’s top law enforcement post.

Ms. Lynch appears to have enough votes for confirmation — though just barely.

Many conservatives have said they will vote against her, citing her defense of the legality of Mr. Obama’s deportation amnesty as evidence that she will not be an independent constitutional referee holding the president in check.

The White House has berated Republican senators for insisting on completing the human trafficking bill first, saying Ms. Lynch has waited longer than any other attorney general nominee in decades.

Some Senate Democrats have hinted at racial motives behind the Republicans’ strategy. However, the inaction has kept in office Mr. Holder, who also is black and is disliked by Republicans.

Republicans said the bipartisan breakthrough on the trafficking bill validated their decision to insist that legislation be finished before Democrats get a vote on Ms. Lynch.

The trafficking bill cleared committee on a unanimous vote and seemed destined for easy passage last month — until Democrats said they noticed a provision applying the so-called Hyde Amendment restrictions, which prohibit federal funds from going to pay for abortions, to fines the government would collect from convicted traffickers.

Some Democrats explained their about-face by saying they never read the bill. Some staffers reportedly acknowledged that they were aware of the Hyde language but didn’t object until pro-choice groups demanded a fight.

Those groups argued that applying to fines was an expansion of the Hyde restrictions, which they said previously applied only to money collected from taxpayers. Republicans countered that the Hyde restrictions applied to all federal funding.

Under terms of the agreement, money collected from traffickers will not go to health-related services but will be spent on services such as legal aid for victims. Health services for victims, meanwhile, would be paid for by existing community health center funds with abortion restrictions, circumventing the need for another abortion fight.

Sen. Amy Klobuchar, Minnesota Democrat, said the two-fund solution came to her while she was traveling through a cornfield during the Senate’s spring break this month. She said she met little resistance as she shopped the idea to colleagues in a series of personal phone calls.

“I just knew it had a chance, because no one ever said it was impossible to do,” Ms. Klobuchar said outside the Senate chamber.

Planned Parenthood Action Fund, a pro-choice group, applauded the breakthrough, saying key Democrats “held the line” against an expansion of Hyde restrictions, while other pro-choice groups bemoaned the fact that Hyde language remained in the bill.

Senate Minority Leader Harry Reid, Nevada Democrat, boasted that he forced Republicans to back off their more expansive abortion restrictions, which he called a “pointless, contrived fight,” clearing the way for the deal.

The trafficking bill still must clear the full Senate, and Mr. McConnell has promised lawmakers a chance to offer amendments. Some Republicans are itching to use the bill as a vehicle for fights over such issues as birthright citizenship for illegal immigrants.

Mr. Reid, though, warned Republicans not to amend the bill, saying it would upset the compromise. “We’re not out of the woods yet, and that’s an understatement,” he said.

His opposition to amendments recalls his time as majority leader, when he regularly used his powers to shut out amendments altogether.

Republicans vowed to change that practice once they took control, and Mr. McConnell said he wanted a more open process in which members of both parties could feel they were getting a say.

So far, the approach is bearing fruit.

The Senate last week passed a bipartisan deal to overhaul Medicare’s formula for paying doctors, and lawmakers have reached other bipartisan agreements on Iran sanctions, an education overhaul and trade promotion.