The spectra of a red giant and a red dwarf are completely different, so there isn't really too much to say about this and distinguishing giants and dwarfs is simple. For example, alkali lines are almost non-existent in red giants, but strong in red dwarfs. The theory as to why this happens is to do with the surface gravity and pressure broadening; it is the stuff of a standard graduate/undergraduate course on stellar atmospheres, not an SE answer.
The fact is that a R=50,000 spectrum with decent signal to noise ratio will quite easily
give you the temperature (to 100K), surface gravity (to 0.1 dex) and metallicity (to 0.05 dex), plus a host of other elemental abundances (including Li) to precisions of about 0.1 dex.
What can you do with this:
You can plot the star in the log g vs Teff plane and compare it with theoretical isochrones appropriate for the star's metallicity. This is the best way to estimate the age of a solar-type (or more massive) star, even if you don't have a distance and is the most-used method. How well this works and how unambiguously depends on the star's evolutionary stage. For stars like the Sun, you get an age precision of maybe 2 Gyr. For lower mass stars, well they hardly move whilst on the main sequence in 10Gyr, so you can't estimate the age like this unless you know the object is a pre-main sequence star (see below).
You can look at the Li abundance. Li abundance falls with age for solar-mass stars and below. This would work quite well for sun-like stars from ages of 0.3-2Gyr and for K-type stars from 0.1-0.5 Gyr and for M-dwarfs between 0.02-0.1 Gyr - i.e. in the range from where Li starts to be depleted in the photosphere until the age where it is all gone. Typical precision might be a factor of two. A high Li abundance in K and M dwarfs usually indicates a pre main sequence status.
Gyrochronology is not much help - that requires a rotation period. However you can use the relationship between rotation rate (measured in your spectrum as projected rotation velocity) and age. Again, the applicability varies with mass, but in the opposite way to Li. M-dwarfs maintain fast rotation for longer than G-dwarfs. Of course you have the problem of uncertain inclination angle.
That brings us to activity-age relations. You can measure the levels of chromospheric magnetic activity in the spectrum. Then combine this with empirical relationships between activity and age (e.g. Mamajek & Hillenbrand 2008). This can give you the age to a factor of two for stars older than a few hundred Myr. Its poorly calibrated for stars less massive than the Sun though. But in general a more active M-dwarf is likely to be younger than a less active M dwarf. It should certainly distinguish between a 2Gyr and 8Gyr M dwarf.
If you measure the line of sight velocity from your spectrum, this can give you at least a probabilistic idea of what stellar population the star belongs to. Higher velocities would tend to indicate an older star. This would work better if you had the proper motion (and preferably the distance too, roll on the Gaia results).
Similarly, in a probabilistic sense, low metallicity stars are older than high metallicity stars. If you were talking about stars as old as 8Gyr, these would be quite likely to have low metallicity.
In summary. If you are talking about G-dwarfs you can ages to precisions of about 20% using log g and Teff from the spectrum. For M dwarfs, unless you are fortunate enough to be looking at a young PMS object with Li, then your precision is going to be a few Gyr at best for an individual object, though combining probabilistic estimates from activity, metallicity and kinematics simultaneously might narrow this a bit.
As an add-on I'll also mention radio-isotope dating. If you can measure the abundances of isotopes of U and Th with long half lives and then make some guess at their initial abundances using other r-process elements as a guide then you get an age estimate - "nucleocosmochronology". Currently, these are very inaccurate - factors of 2 differences for the same star depending on what methods you adopt.
Read Soderblom (2013); Jeffries (2014).
EDIT: Since I wrote this answer, there is at least one more promising method that has emerged. It turns out that the abundance of certain s-process elements (e.g. barium, yttrium) are enriched gradually during the lifetime of the Galaxy (by the winds of dying asymptotic giant branch stars). Thus a measurement of the relative fractions of these elements can give the age to precisions of a billion years or so (e.g. Tucci Maia et al. 2016).