Unofficially the Starship class is due to certain specifications and qualities of a particular starship.
According to The Star Trek Wikia.
http://en.memory-alpha.org/wiki/Category:Starship_classes
A class of starship is a term referring to the design of a group of
vessels built to the specifications, capabilities, modification or
type arrangement and outfitting. Many cultures name separate series or
classes based on these qualities. A starship classification is usually
used to refer to the general abilities of a vessel, but a specific
class designation refers to its shape or layout in differing degrees,
according to how specific species and cultures use the term.
Here is an example of what the Intrepid-class Starship was.
http://en.memory-alpha.org/wiki/Intrepid_class
The Intrepid-class starship was a Federation design that entered
service in the later half of the 24th century. The Intrepid-class was
designed for long-term exploration missions. At less than half the
size of a Galaxy-class starship, it was considered "quick and smart."
Another example would be the Galaxy-class Starship.
http://en.memory-alpha.org/wiki/Galaxy_class
The Galaxy Class Starship Development Project began in the 2350s at
Utopia Planitia Fleet Yards. (TNG: "Booby Trap", "Eye of the
Beholder") Numerous technologies implemented on Galaxy-class starships
were tested aboard earlier prototype vessels, including the
Oberth-class USS Pegasus in the 2350s. (TNG: "The Pegasus")
The warp core was designed at Outpost Seran-T-one on stardate 40052 by
some of the most brilliant engineering minds in the Federation,
including Leah Brahms of the Theoretical Propulsion Group. (TNG:
"Booby Trap")
http://en.memory-alpha.org/wiki/Starship_classification
Unofficially, many starships are classified by their design type. Although Starfleet tries not to classify their vessels in any such categorization, there have been numerous occasions where a Starfleet officer referred to Starfleet or enemy vessels by type during a fleet engagement, such as in Operation Return when Captain Sisko calls upon Galaxy wings to engage Galor-class destroyers. (DS9: "Sacrifice of Angels")