Several Phoenix suburbs are among the nation's best cities for first-time homebuyers, according to a new ranking.

The ranking by WalletHub, a personal finance website, placed the Southeast Valley town of Gilbert 10th in the nation for those buying their first home. Its neighbor to the west, Chandler, ranked 11th, while Peoria, in the Northwest Valley, was 13th.

Also making the list's top 30 were Scottsdale, at 22nd, and Surprise, at 30th. Phoenix itself was 45th on the list.

The ranking scored each city by affordability, real-estate market and quality of life. In the affordability category, Gilbert ranked fourth nationally, while Surprise was seventh. Chandler ranked 10th for affordability, while Peoria's real-estate market ranked 10th.

WalletHub said the study compared 300 cities of varying sizes across the United States. Broken Arrow, Oklahoma, took the top spot for first-time homebuying, while Berkeley, California, came in last.