Examples of how to use an NPN bipolar junction transistor (BJT, top circuit) and an N-channel field-effect transistor (FET, middle circuit) as a switch in much the same way that relays are used.
Each switch circuit uses a 5 volt DC power source to turn on a 60 DC volt lamp.
For comparison, the relay circuit on the bottom performs the same function.
Advantages of BJT and FET vs relay:
1. Uses less power than the relay coil
2. Smaller than relays
3. Solid state...no moving parts
4. No voltage spike from relay coil
Advantages of FET:
1. Uses less power than BJT
2. Controls larger load currents than BJT
Advantages of a relay:
1. Can control larger loads, including AC
2. Not sensitive to static damage
3. Can use DPDT switching