Spider-Man is gifted with incredible reflexes and super strength - which doesn't mean that he is immortal. Criminals' attacks will hurt him and can eventually kill him. Luckily, Marvel's Spider-Man has a nice healing mechanic to help you survive the toughest battles in the game.
In order to heal yourself in combat, you must have a certain amount of focus. You can gain it by fighting or swinging on the web. Throwing objects and fighting in the air also generate a lot of focus. Once you have accumulated a certain amount, press the lower arrow on the controller.
Spider-Man will be recovering health for some time, depending on the amount of focus you've used. Note that health gains are not instantaneous, so try to heal up as need it. After a while, you will unlock a modification for the costume - First Aid, which increases the amount of health regained using focus. It's a good idea to install this upgrade if you need to heal often and feel that your character is underpowered. Also remember that Peter's health bar is extended from time to time when you advance to a certain level of experience.