The design of electrochemically active materials with appropriate structures and compositions is very important for applications in energy conversion and storage devices. Herein, we demonstrate an effective strategy to prepare microporous heteroatom-doped carbon frameworks derived from naturally-abundant pine needles. The preparation procedure is based on the carbonization of pine needles, followed by KOH activation at a temperature range of 700-1000 °C. The resultant nitrogen-doped carbon consists of abundant micropores and an ultrahigh specific surface area (up to 2433 m2 g-1), leading to high performances in electrocatalytic hydrogen evolution reaction (HER) and supercapacitors. Specifically, when the pine needle-derived carbon (activated at 800 °C) serves as a HER electrocatalyst, it exhibits a low onset potential (∼4 mV), a small Tafel slope (∼45.9 mV dec-1) and a remarkable stability over long-term cycling. When evaluated as an electrode material for supercapacitors, the pine needle-derived carbon (activated at 900 °C) demonstrates high specific capacitance (236 F g-1 at 0.1 A g-1), remarkable rate capability (183 F g-1 at even 20 A g-1) and good long-term stability. Notably, the specific capacitance at 2.0 A g-1 increased from ∼205 to ∼227 F g-1 after cycling for 5000 times, owing to the further activation and wetting of the electrodes. This novel and low-cost biomass-derived carbon material is very promising for many applications, especially in electrocatalytic water splitting and supercapacitors.