In spark-shell:
spark-shell
sc.version
Generally in a program:
SparkContext.version
Using spark-submit:
spark-submit
spark-submit --version