Square (NYSE:SQ) closed out 2016 in fine fashion. For the fourth quarter, the payments company generated a loss per share of $0.04 on revenue of $452 million. That's a much narrower loss than the $0.09 per share analysts were expecting, and a modest beat on the top line as well. Square also reported adjusted EBITDA of $30 million, well above its guidance of $16 million to $18 million.

Square's margin expansion is encouraging for patient investors. Adjusted EBITDA margin improved a whopping 20 percentage points year over year last quarter, to 16%. "This improvement reflects strong top-line growth, and benefits from improved operational efficiency and ongoing improvements in our risk management," CFO Sarah Friar told investors on the company's fourth quarter earnings call.

Let's dig into the specifics as to what's driving Square's stellar performance.

Square register running on a laptop and smartphone

Image source: Square.

Square Capital

One of the biggest contributors to Square's earnings beat was Square Capital. "We saw very strong seasonality in Capital, when we had expected it perhaps to drop off more toward the end of the year," Friar told analysts.

Square facilitated 40,000 business loans totaling $248 million in the fourth quarter. That's an increase of 68% year over year. Importantly, Square has been able to grow its lending service without taking on unnecessary risk. Default rates remained below 4%.

At the same time, Square isn't having trouble finding investors to back its loans, which allows it to grow as much as it wants. Square faced some difficulties at the beginning of 2016, but all of those issues seem to be resolved. "We have a very healthy group of investors in place today that can absolutely meet the capacity for growth for Capital for 2017. And we have a list of investors who would like to get in on the program, too," Friar said.

Other new products

Square made a big point of highlighting the strength of its newer products, i.e., products launched in 2014 or later. These new products accounted for 14% of total revenue and 25% of adjusted revenue in the fourth quarter.

Most of Square's new products fall under subscription and services revenue, which is a recategorization of Square's software and data segment. Square Capital accounts for a large portion of the subscription and services revenue, but the segment also includes Caviar -- its food delivery platform -- as well as Invoices. Overall, the segment grew 81% year over year.

The outsized growth of these new products is important because they carry higher margins than Square's core payments service. As a result, Square's margins continue to expand. Square guided for another 5 percentage point adjusted EBITDA margin expansion in the first quarter.

Room for improvement

Square is starting to show a little bit of operating leverage, but there's a lot of room for improvement as the company continues to scale. For the full year of 2016, operating expenses represented 43.7% of revenue in 2016, compared to 43% for all of 2015. That improved in the fourth quarter, when Square spent 39.9% of revenue on operating expenses, versus 41.9% the previous year.

The trend started moving in the right direction in the fourth quarter. For the most part, though, Square's improving operating margin is being driven by the higher gross margin products discussed above.

Investors shouldn't expect margins to expand overnight, though. Square continues to plow money into marketing in order to attract more merchants. As long as it's seeing a consistent return on investment, there's no reason it should slow down. Expect Square to stick closely to its 5 percentage point EBITDA margin expansion guidance and invest anything extra back into growing the business.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.