The goal of this paper is to develop a numerical algorithm that solves a two-dimensional elliptic partial differential equation in a polygonal domain using tensor methods and ideas from isogeometric analysis. The proposed algorithm is based on the Finite Element (FE) approximation with Quantized Tensor Train decomposition (QTT) used for matrix representation and solution approximation. In this paper we propose a special discretisation scheme that allows to construct the global stiffness matrix in the QTT-format. The algorithm has $O(log n)$ complexity, where $n=2^d$ is the number of nodes per quadrangle side. A new operation called z-kron is introduced for QTT-format. It makes it possible to build a matrix in z-order if the matrix can be expressed in terms of Kronecker products and sums. An algorithm for building a QTT coefficient matrix for FEM in z-order on the fly, as opposed to the transformation of a calculated matrix into QTT, is presented. This algorithm has $O(log n)$ complexity for $n$ as above.