A US inmate heaved and coughed 13 minutes into his execution by injection and appeared to move during tests meant to determine consciousness.
Ronald Bert Smith Jr, 45, was finally pronounced dead at 11.05pm local time on Thursday night - about 30 minutes after the procedure began at the state prison in south-west Alabama.
Alabama uses the sedative midazolam as the first drug in a three-drug lethal injection combination.
Smith and other inmates argued in a court case that the drug was an unreliable sedative and could cause them to feel pain, citing its use in problematic executions.
The US Supreme Court has upheld the use of the drug.
Smith was convicted of capital murder over the November 8 1994 fatal shooting of shop worker Casey Wilson.
A jury voted 7-5 to recommend a sentence of life imprisonment, but a judge overrode that recommendation and sentenced Smith to death.
At the beginning of his execution, Smith heaved and coughed repeatedly, clenching his fists and raising his head.
A prison guard performed two consciousness checks before the final two lethal drugs were administered.
In a consciousness test, a prison officer says the inmate’s name, brushes his eyelashes and then pinches his left arm.
During the first one, Smith moved his arm. He slightly raised his right arm again after the second consciousness test.
The meaning of those movements is likely to be debated.
One of Smith’s lawyers whispered to another lawyer, "He’s reacting," and pointed out the inmate’s repeated movements.
The state prison commissioner said he did not see any reaction to the consciousness tests.
"We do know we followed our protocol. We are absolutely convinced of that," Alabama corrections commissioner Jeff Dunn said.
When asked if the movements indicated the state’s process should be changed, Mr Dunn said: "There will be an autopsy that will be done on Mr Smith and if there were any irregularities, those will hopefully be shown or born out in the autopsy.
"I think the question is probably better left to the medical experts."
Alabama’s execution recalled memories of a botched 2014 execution in Oklahoma.
In that execution, inmate Clayton Lockett writhed, moaned and pulled up from his restraints after being administered the state’s three-drug execution protocol.
Execution team members considered trying to save his life and took Lockett to an emergency room before he finally died, 43 minutes after his initial injection.
Just before Thursday night’s execution began, Smith replied "No ma’am" when asked by the prison warden if he had any final words.
A member of Wilson’s family, who was not identified, witnessed the execution. The victim’s family did not make a statement.
Wilson was pistol-whipped and then shot in the head during the robbery in Huntsville, court documents show.
Surveillance video showed Smith entering the shop and recovering spent shell casings from the bathroom where Wilson was shot, according to the record.
In overriding the jury’s recommendation at the 1995 trial, a judge likened the killing to an execution, saying Wilson had already been pistol-whipped into submission and Smith ignored his pleas for mercy.
Wilson had a newborn infant at the time of his death.
"The trial court described Smith’s acts as ’an execution-style slaying’. Tonight, justice was finally served," Alabama attorney general Luther Strange said in a statement after the execution.
US Supreme Court justices twice paused the execution as Smith’s lawyers argued for a delay, saying a judge should not have been able to impose the death penalty when a jury recommended he receive life imprisonment.
Four liberal justices said they would have halted the execution, but five were needed to do so.
Smith’s lawyers had urged the nation’s highest court to block the planned execution to review the judge’s override.
Smith’s lawyers argued a January decision that struck down Florida’s death penalty structure because it gave too much power to judges raises legal questions about Alabama’s process.
In Alabama, a jury can recommend a sentence of life without parole, but a judge can override that recommendation to impose a death sentence.
Alabama is the only state that allows judicial override, they argued.
"Alabama is alone among the states in allowing a judge to sentence someone to death based on judicial fact finding contrary to a jury’s verdict," lawyers for Smith wrote on Wednesday.
Lawyers for the state argued in a court filing on Tuesday that the sentence was legally sound, and that it is appropriate for judges to make the sentencing decision.
Smith, the son of a Nasa contract employee, became an Eagle Scout at 15, but his life spiralled downward because of alcoholism, according to a clemency request to Alabama’s governor.
He had a final meal of fried chicken and French fries and was visited during the day by his parents and son.
Alabama has been attempting to resume executions after a lull caused by a shortage of execution drugs and litigation over the drugs used.
The state executed Christopher Eugene Brooks in January over the 1993 rape and beating death of a woman.
It was the state’s first execution since 2013.
Judges stayed two other executions that had been scheduled this year.