Yes, they kind of had the votes

Initially, after the first vote, Mike Johnson (R- LA) did not have the votes to continue being the Republican speaker of the house. He lost at least 3 members of his party. The vote was never gaveled, and 2 members returned to adjust their votes to elect Mike Johnson on the first ballot.

The United States House of Representatives has had a speaker for: