Absolutely. While I personally don't advocate buying anything new, if you gotta, it's a great way to go.
My previous car was a 2015 Mazda 3 Grand Touring bought with 8,000 miles on it for $20k (about $26-27k MSRP new). All the luxuries and bells and whistles!
Not a horrible vehicle for the price.
Mazda 3 used to be a $20k car (and even less before that) but now starts just over $24k (sedan) / $25k (hatchback).