A day after scrapping a planned merger with Frontier Airlines, the Miramar-based Spirit Airlines on Thursday announced a deal with JetBlue. Under the deal, JetBlue will pay $3.8 billion, or $33.50 a share, to buy Spirit. A news release said the deal will create the country’s fifth-largest carrier. The purchase still needs approval from regulators and is expected to close by the first half of 2024, according to the news release. JetBlue and Spirit will continue operating separately until the deal closes. The deal ended months of uncertainty about whether Spirit would merge with Frontier or JetBlue. Spirit announced Wednesday it had terminated a merger agreement with Frontier.