In general terms magistrate has come to mean any public official with power, but specifically within the legal system of England and Wales it refers to a justice of the peace sitting in a magistrates' court, acting as judge who tries minor offenses. Which means that since justices of the peace have no other duties these days means that the two are virtually synonymous.
They are formally appointed by the Lord Chancellor, except within the Duchy of Lancaster where they are appointed by the Chancellor of the Duchy of Lancaster. (There is no sane reason for this differentation; it's purely an historical anachronism that nobody can be bothered to change.)
There are two types of magistrate engaged within England and Wales
1) Stipendiary Magistrate
A full-time, legally qualified magistrate, that normally presides at a court in a major town or city where there is a heavy workload. There are less than a 100 stipendiary magistrates in England and Wales.
2) Lay Magistrate
A part-time unpaid volunteer magistrate, without any formal legal training of which there are some 28,000.
Hence the vast majority of presiding magistrates are of the lay variety. They are intended to be members of the local community, and these days the authorities take great pains to make sure they are representative of the community. Despite the lack of any requirment for formal qualifications, lay magistrates do receive specific training to perform their duties and whilst they don't get paid, they do receive allowances to cover travelling expenses and subsistence.
And yes, a stipendiary magistrate is indeed a justice of the peace.
Justices of the Peace Act 1997
Chapter 25 Part II Justices Of The Peace
Section 11 (2) A person so appointed to be a stipendiary magistrate in any commission area shall by virtue of his office be a justice of the peace for that area.
See http://www.hmso.gov.uk/acts/acts1997/97025--c.htm