How do I use riposte and counter-attack?

Solution 1:

From the manual:

You begin the counterattack with your block up (holding the E key) – when an opponent will try to land a blow on you, the icon on his body will turn into a sword icon for a moment, signifying the best opportunity to counterattack. At this point you should press LMB and Geralt will make a dodge and a dynamic riposte.

Yes, it uses up vigor as a normal block action.