This semiconductor device includes a drift layer (11), a base layer (12) formed on the drift layer, a collector layer (21) and a cathode layer (22) disposed opposing the base layer, a plurality of trenches (13) penetrating the base layer, gate electrodes (17a, 17b) formed in the respective trenches, an emitter region (14) formed in a surface part of the base layer in such a manner as to contact each trench, a first electrode (19) connected to the base layer and the emitter region, and a second electrode (23) connected to the collector layer and the cathode layer. The gate electrode (17b) in a diode region of the semiconductor substrate can be controlled in a different way from that of the gate electrode (17a) in an IGBT region, and a voltage is applied to the gate electrode (17b) so as not to form an inversion layer (24) in the base layer.