He was the son of Jan Mastalerz (1858–1947), train driver, and née Dobke Sophia (1875–1937). He attended high school in Czestochowa. He belonged to the National Youth Organisation of Secondary Schools and the Organization of the Polish Youth "Future" (PET). In September 1912 he co-founded the scout team. At the end of 1912, as a student of class VII, he was arrested by the Russians and taken into custody in Czestochowa. After his release he moved to Warsaw, where he attended school. Fearing re-arrest, he moved to Lviv, and there continued his studies at Matura courses. In 1914, he passed the exams. During this period he was a member of the Polish Rifle Teams.
From 1914 he served in a Squadron 1st Regiment of Cavalry of the First Brigade of the Polish Legions. After the oath crisis from July 1917 to 1918 he was interned in Szczypiorno near Kalisz, then in Lomza. From November 1918 he served in a Cavalry Regiment. He participated in the defense of Lviv, then in the Polish-Bolshevik War. In April 1919 he was appointed second lieutenant, and in August 1920 he was promoted to lieutenant and captain.
In 1925–1926 he served in Korpus Ochrony Pogranicza and in May 1926 he was promoted to the rank of Major. In 1926–1930 he served again in the 1st Regiment of Cavalry. In 1930 he was appointed lieutenant colonel. In March 1930 in Cracow, Mastalerz took command of the 8 Cavalry Regiment. He held this position until 1939. In 1934, he was promoted to colonel. On 1 August 1939 he was appointed to command the 18th Pomeranian Cavalry Regiment, which was part of the Pomeranian Cavalry Brigade.
Mastalerz saw action in the German Invasion of Poland at the outset of World War II. On 1 September he died commanding his cavalry unit during the Charge at Krojanty, when he was cut down by machine gun fire. He was killed while trying to rescue Eugeniusz Świeściak, the commander of the 1st Squadron of the 18th Pomeranian Cavalry.
He was buried at the cemetery in Chojnice.
- Double-Cross of Military Virtue: 5 class (1920), 4 class (1939-posthumously),
- Independence Cross,
- Cross of Valour (3-fold)
- On 7 December 1927 he was awarded the Silver Cross of Merit
- Gold Cross of Merit (1937).
- "Cmentarz Kule w Częstochowie" author Juliusz Sętowski
- PSB, t. XX (S.Poręba);
- Kawalerowie Virtuti Militari, t. III (1939), cz.I (B. Polak)s. 79–80 (misspelled Masztalerz);
- Księga żołnierzy polskich, t. I, s. 458;
- Lista strat WP 1918–1920, s. 544 (dot. brata Jana);
- „Niepodległość” 1958, t. VI s.117;
- „Świat Szkolny” 1928, nr 7 s.6 (dot. brata Jana);
- „Ziemia Częstochowska” t. XXVI, 1999 (J. Sętowski), s. 19,20;