Which- refers to a closed set:
'Which of these do you want?'
You couldn't replace this with 'what'. There are cases where there isn't much difference, but where the choice is clearly restricted, then 'which' would be the better choice.
You use "Which" when you must to choose between options; For example: "Which color do you prefer?"