It happened at St Stephen’s Episcopal Church in the town of Vestavia Hills and a suspect is in custody, the town’s police department said on Facebook.
The shooting took place as the church was holding a potluck dinner, the church said on its website.
Police captain Shane Ware told reporters that a lone assailant entered the church and started shooting. Three people were hit: Two have died and the other is being treated, he said.
The United States is in the midst of a particularly gruesome chapter of its epidemic of gun violence. The worst case in this stretch was a shooting at an elementary school in Uvalde, Texas that left 19 children and two teachers dead on May 24.
Since the start of the year, more than 20,000 people have died of firearm violence in the US, according to a non-governmental organisation called the Gun Violence Archive. This includes deaths by suicide.
Meanwhile, the lead Republican negotiator in US Senate efforts to craft a bipartisan gun safety bill walked out of the talks on Thursday, while the lead Democrat remained optimistic that lawmakers could vote on legislation before leaving for a two-week July 4 recess.
"It's fish or cut bait," Senator John Cornyn said after hours of negotiations that included his fellow Republican Senator Thom Tillis and Democratic Senators Chris Murphy and Kyrsten Sinema.
"I don't know what they have in mind, but I'm through talking," Mr Cornyn said.
However, Mr Tillis and Mr Murphy later said the talks were close to reaching agreement and added that legislative text for a bill could emerge in coming days.
The bipartisan group has been working on a deal to curb gun violence since a gunman killed 19 school children and two adults in Uvalde, Texas, less than two weeks after a racist shooting in Buffalo, New York left 10 dead. Talks have bogged down in recent days.
"To land a deal like this is difficult. It comes with a lot of emotions. It comes with political risk to both sides. But we're close enough that we should be able to get there," said Mr Murphy, the lead Democratic negotiator.
Mr Murphy later issued a statement saying: "I believe we can bring this to a vote next week."
Time to pass major legislation is running short as the Nov 8 midterm elections, when Republicans are looking to win back control of Congress, draw nearer.
Mr Murphy and Mr Tillis each told reporters that staff have begun drafting legislative text for the majority of provisions that lawmakers have agreed on. Mr Tillis suggested that text could be available as early as Friday.
Mr Tillis, saying he expected a deal, declined to speak in detail about the negotiations: "We're too close and down to the final stages."
The group announced a framework on measures to curb gun violence on Sunday. It did not go as far as Democrats including President Joe Biden had sought, but would still be the most significant action to combat gun violence to emerge from Congress in years if passed.
Disagreements remained over two main provisions: how to provide incentives to states to create "red flag" laws, in which guns can be temporarily taken away from people who are deemed dangerous; and the "boyfriend loophole", which allows the authorities to block abusive spouses from buying firearms but does not cover "intimate partners" who are not married.
Mr Cornyn, whose home state of Texas does not have a "red flag" law and is seen as unlikely to enact one, wants the funding for that provision to cover other efforts for people with mental illness, such as "crisis intervention programmes".
Mr Tillis said the negotiators were working out a mechanism that would allow federal funding for states that want to adopt red flag laws and states that favour other intervention programs, with parity the ultimate goal.
He also said the lawmakers were looking to existing state laws as models for the boyfriend loophole provision.