Internet of Things (IoT) networks are increasingly used for edge data analytics, i.e., collecting and analyzing data at the network edge. However, the IoT devices are typically resource-constrained and cannot support fast and accurate execution of such tasks, while the involvement of distant cloud servers is often impractical and entails huge communication overheads. To address this problem, we develop a framework for enabling the devices to collaboratively execute their tasks, exploiting their proximity and resource complementarity. Our mechanism relies on an auction-based algorithm that optimizes the execution accuracy and delay for all tasks, without requiring information about the performance priorities of nodes. The algorithm yields the optimal task - node assignment, and the necessary reimbursements for ensuring the devices' cooperation, by using the auction for dual subgradient evaluations. We further extend this mechanism for multi-stage analytics and explain how it can be implemented in a decentralized fashion, namely without an auctioneer. We conduct a battery of testbed experiments with representative data analytic applications that show gains both in accuracy and delay compared to heuristic and greedy policies, and verify the minimal computation and communication overheads of our solution.