hubs can work at layer 1 or layer 1.5 (MAC learning/filtering like Switch).
Switches can work at layer 2 or 3/4 (Multilayer Switches)
The basic difference is hub works on physical signal based.
switches have switching functions based layer 2 address based(MAC, DLCI, VPI/VCI...).
Routers do routing, work on layer 3 address (IP, IPX)
Nowadays there are "routing switches" and "switch router" appeared in the market which made the conceptual difference between switches and router more and more vague.
BTW: "level" is not the accurate word, "layer" should be used here.