Section 4. A civil action in the nature of certiorari to correct errors in proceedings which are not according to the course of the common law, which proceedings are not otherwise reviewable by motion or by appeal, may be brought in the supreme judicial or superior court or, if the matter involves any right, title or interest in land, or arises under or involves the subdivision control law, the zoning act or municipal zoning, or subdivision ordinances, by?laws or regulations, in the land court or, if the matter involves fence viewers, in the district court. Such action shall be commenced within sixty days next after the proceeding complained of. Where such an action is brought against a body or officer exercising judicial or quasi-judicial functions to prevent the body or officer from proceeding in favor of another party, or is brought with relation to proceedings already taken, such other party may be joined as a party defendant by the plaintiff or on motion of the defendant body or officer or by application to intervene. Such other party may file a separate answer or adopt the pleadings of the body or officer. The court may at any time after the commencement of the action issue an injunction and order the record of the proceedings complained of brought before it. The court may enter judgment quashing or affirming such proceedings or such other judgment as justice may require.